<template>
  <div class="main" id="main" style="position:relative">
    <!-- 活动信息 -->
    <div class="act-info">
      <div class="act-title">活动信息</div>
      <div class="act-content">
        <div
          class="image"
          :style="{'background': 'url(' + baseActInfo[0].src +') center center / cover no-repeat'}"
        >
          <!-- <img :src="baseActInfo[0].src" alt /> -->
        </div>
        <div class="detail">
          <div class="small-title">{{ baseActInfo[0].title }}</div>
          <div class="desc">出行日期：{{ period?period:baseActInfo[0].desc }}</div>
        </div>
      </div>
    </div>
    <!-- 日期选择 -->
    <!-- <div
      class="calendar-select"
      v-if="actInfo.subType==2 || actInfo.subType==4 || actInfo.subType==5"
    >
      <div class="calendar-title" style="padding:0">日期选择</div>
      <div class="calendar-box">
        <div class="calendar-list">
          <div
            class="calendar-item"
            :class="{'active':index == calendarSelect,'disable':item.disable}"
            v-for="(item,index) in calendarList"
            :style="{borderColor:index == calendarSelect ? themeStyle.backgroundColor : ''}"
            :key="index"
            @click="selectCalendar(index,item)"
          >
            <div class="day">{{ item.day | getDay }}{{ item.tian | getWeek }}</div>
            <div class="price">
              <span v-if="!item.disable">¥ {{ item.price }}</span>
            </div>
            <img src="./detail/assets/img/order/seled.png" alt v-show="index == calendarSelect" />
          </div>
        </div>
        <div class="calendar-more" @click="getMoreDate">
          <img src="./detail/assets/img/order/morecal.png" alt />
          <span>选择日期</span>
        </div>
      </div>
    </div>-->
    <!-- 套餐类型 -->
    <div class="package-type" v-if="packagePayArray.length>0">
      <div class="package-title">套餐类型(共{{packagePayArray.length}}个)</div>
      <div class="scroll-wrap" id="scroll-wrap" style="width:100%;height:60px;padding-top:20px">
        <div class="package-list" id="package-list">
          <div
            class="package-item"
            :class="index == packageSelect ? 'active' : ''"
            v-for="(item,index) in packagePayArray"
            :style="{background:index == packageSelect ?themeStyle.rgba:'',color:index == packageSelect ?'#fff':''}"
            :key="index"
            @click="selectPackage(index)"
          >
            <div
              class="tag"
              :style="{background:index == packageSelect ? themeStyle.backgroundColor:'',color:index == packageSelect ?'#fff':''}"
            >套餐{{ item.key }}</div>
            <div class="tit" style="font-size:12px;margin-top:2px">{{item.value}}</div>
            <div
              class="small-desc"
              style="font-size:13px;font-weight:700;color:#333"
              :style="{color:index == packageSelect ? '#fff' : ''}"
            >{{ item.price }} <span v-if="item.childPrice">(儿童:¥{{item.childPrice}})</span> </div>
            <div
              class="sanjiao"
              :style="{borderTop:index == packageSelect ? '7px solid '+ themeStyle.rgba:''}"
            ></div>
            <!-- <img src="./detail/assets/img/order/seled.png" v-show="index == packageSelect"  alt /> -->
          </div>
        </div>
      </div>
    </div>

    <!-- 游客信息 -->
    <div class="tourist-info">
      <div class="tourist-title">报名信息</div>
      <div class="tourist-list tourist-list-new">
        <div
          class="item item1"
          v-for="(user,userIndex) in enrollUsers"
          :key="userIndex"
          v-show="user.isChecked"
        >
          <div class="left">出行人</div>
          <div class="mid">
            <div class="name" @click="editUser(user,userIndex,1)">{{ user.name }}  {{ user.phone }}</div>
            <!-- <div class="phone">{{ user.phone }}</div> -->
            <div class="phone">
              <selector
                  style="color: #333;font-size:14px;border:0"
                  :title="'集合地:' + '<span' + ' '+ 'style=' + 'color:red' + '>*</span>'"
                  label-width="105px"
                  :options="assembles"
                  v-model.trim="user.place"
                  @on-change="calculateOrder"
                  v-if="enrollOption.need_assemble"
                ></selector>
            </div>
            <div class="phone" v-for="(item, index) in user.addtionPayInfo" :key="index">
              <div class="check-Layout">
                <div class="check-title-layout" style="width:105px">{{item.title}}</div>
                <div
                  style="line-height:30px;color:#646464;font-size:13px"
                >¥{{item.price}}</div>
                <x-switch
                  class="switch-layout"
                  title
                  v-model.trim="item.isSelected"
                  @on-change="calculateOrder"
                  style="margin-left:auto"
                ></x-switch>
              </div>
              <!-- <div style="width:calc(100% - 16px);height:1px;background-color:#eee"></div> -->
            </div>
            <div class="tip" @click="editUser(user,userIndex,1)">{{user | integrityedit}}</div>
            <van-icon @click="editUser(user,userIndex,1)" class="edit" :color="themeStyle.backgroundColor" size="25" name="edit" />
          </div>
          <div class="btn" @click="user.isChecked = false;calculateOrder()" style="height:30px;align-items: center;">
            <svg t="1604394392402" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="26738" width="17" height="17"><path d="M519.620465 0c-103.924093 0-188.511256 82.467721-192.083349 185.820279H85.015814A48.91386 48.91386 0 0 0 36.101953 234.686512a48.91386 48.91386 0 0 0 48.913861 48.866232h54.010046V831.345116c0 102.852465 69.822512 186.844279 155.909954 186.844279h439.200744c86.087442 0 155.909953-83.491721 155.909954-186.844279V284.100465h48.91386a48.91386 48.91386 0 0 0 48.913861-48.890046 48.91386 48.91386 0 0 0-48.913861-48.866233h-227.756651A191.559442 191.559442 0 0 0 519.620465 0z m-107.234232 177.080558c3.548279-49.771163 46.627721-88.540279 99.851907-88.540279 53.224186 0 96.327442 38.745302 99.351813 88.540279h-199.20372z m-111.997024 752.044651c-30.981953 0-65.083535-39.15014-65.083535-95.041488V287.744h575.488v546.839814c0 55.915163-34.077767 95.041488-65.059721 95.041488H300.389209v-0.500093z" fill="#666666" p-id="26739"></path><path d="M368.116093 796.814884c24.361674 0 44.27014-21.670698 44.27014-48.818605v-278.623256c0-27.147907-19.908465-48.818605-44.27014-48.818604-24.33786 0-44.27014 21.670698-44.27014 48.818604v278.623256c0 27.147907 19.360744 48.818605 44.293954 48.818605z m154.933581 0c24.361674 0 44.293953-21.670698 44.293954-48.818605v-278.623256c0-27.147907-19.932279-48.818605-44.293954-48.818604-24.33786 0-44.27014 21.670698-44.270139 48.818604v278.623256c0 27.147907 19.932279 48.818605 44.293953 48.818605z m132.810419 0c24.33786 0 44.27014-21.670698 44.27014-48.818605v-278.623256c0-27.147907-19.932279-48.818605-44.27014-48.818604s-44.27014 21.670698-44.27014 48.818604v278.623256c0 27.147907 19.360744 48.818605 44.27014 48.818605z" fill="#666666" p-id="26740"></path></svg>
          </div>
        </div>
        <div class="item" style="height:40px">
          <!-- <div class="left">[新增]</div> -->
          <div class="mid" style="color:#666;background:rgb(241,246,250);display: flex;justify-content: center;align-items: center;" @click="openAddPersonFlag()"> <van-icon style="font-weight:600" size="18" color="#499FF8" name="plus" />添加出行人</div>
          <!-- <div class="btn" @click="openAddPersonFlag()">
            <van-icon style="font-weight:600" size="18" color="#499FF8" name="plus" />
          </div> -->
        </div>
      </div>
      <!-- <div class="tourist-list">
        
        <div class="tour-item" 
        :class="user.isChecked ? 'active' : ''" 
        v-for="(user,userIndex) in enrollUsers" :key="userIndex" 
        
        
        @click="checkClick(user,userIndex)">
          {{ user.name }}
          <img src="./detail/assets/img/order/seled.png" v-show="user.isChecked" alt />
        </div>
        <div class="add-change" @click="showAddPersonModal" :style="{color: themeStyle.backgroundColor,borderColor:themeStyle.backgroundColor}">+新增</div>
        <div class="add-change" style="margin-left:10px" @click="copyFlag = true" :style="{color: themeStyle.backgroundColor,borderColor:themeStyle.backgroundColor}">+粘贴名单</div>
      </div>
      <div class="info-inp">
        <div class="info-item" v-for="(user,userIndex) in enrollUsers" :key="userIndex" v-show="user.isChecked">
          <div class="info-item-right">
            <div class="right-left" @click="editUser(user,userIndex)">
              <div class="box">
                <div class="top"><span style="font-size:14px;font-weight:bold;">{{ user.name }}</span>  {{ user.adult ==1? '成人':'' }}{{ user.adult ==2? '儿童':'' }}</div>
                <div class="bot">手机号 {{ user.phone }}</div>
              </div>
              <div class="jian" style="color:#666">></div>
            </div>
            <div class="right-right">
              <img @click="delModal(user, userIndex)" src="./assets/img/act_enroll_del.png" alt="">
            </div>
          </div>
          <div class='tip'>{{user | integrity}}</div>
          <div class="tip" style="color:#999">{{user | integrity1}}</div>
        </div> 
      </div>-->
    </div>

    <div class="tourist-info">
      <div class="tourist-title">优惠信息 <span class="dis-tip" v-if="false">小计：<span style="color:rgb(252, 94, 94)">-10元</span></span> </div>
      <div class="tourist-list discount-list">
        <div class="item" v-if="couponNames.length>1">
          <div class="mid">
            <van-cell title="优惠券" @click="selectCoupon" is-link :value-class="chooseCoupon.value?'usediscount':''" :value="chooseCoupon.value?chooseCoupon.label:'请选择优惠券'" />
          </div>
        </div>
        <div class="item" v-if="coninText">
          <div class="mid switch">
            <van-field name="switch" :label="coninText">
              <template #input>
                <van-switch active-color="#07c160" v-model.trim="isUseConin" size="20" />
              </template>
            </van-field>
          </div>
        </div>
        <div class="item" v-if="!!vipDiscount.label">
          <div class="mid">
            <van-cell :title="vipDiscount.label"  :value="vipDiscount.value" />
          </div>
        </div>

        <div class="item " v-if="false">
          <div class="mid">
            <van-field
              v-model.trim="discountCode"
              center
              label="优惠码优惠"
              placeholder="请输入8位字符优惠码"
            >
              <template #button>
                <van-button @click="searchCode()" size="mini" plain hairline type="primary" :disabled="discountCode.length<8?true:false">确定使用</van-button>
              </template>
            </van-field>
          </div>
        </div>

        
      </div>
    </div>

    <!-- 订单明细-->
    <div class="buy-number">
      <div class="buy-title">订单明细</div>
      <div class="buy-box">
        <div class="buy-bigpeople">
          <div class="buy-left">
            <span>成人</span>
            <span>{{ bigPerson.num }}人</span>
          </div>
          <div class="buy-right">
            <div class="buy-count">
              <button
                v-if="false"
                :style="{background:'#ececec',color:'#b8b8b8'}"
                @click="reduceBig()"
              >-</button>
              <span
                :style="{color:'#fc5e5e'}"
                v-if="!packagePayArray.length>0"
              >{{ bigPerson.price }}元/人<span v-if="actInfo.prePay">（ 定金¥{{actInfo.prePay}}）</span></span>
              <span
                :style="{color:'#fc5e5e'}"
                v-if="packagePayArray.length>0"
              > <span>{{ bigPerson.price }}元/人</span> <span>(套餐价)</span><span v-if="actInfo.prePay">（ 定金¥{{actInfo.prePay}}）</span></span>
              <button
                v-if="false"
                :style="{background:'#afe9f1',color:'#02bad3'}"
                @click="addBig()"
              >+</button>
            </div>
          </div>
        </div>
        <div class="buy-smallpeople" v-if="smallPerson.price>0 && actInfo.isNeedChild">
          <div class="buy-left">
            <span>儿童</span>
            <!-- <span :style="{color:'#fc5e5e'}" v-if="actInfo.isNeedChild && !packagePayArray.length>0">{{ smallPerson.price }}/人</span>
            <span :style="{color:'#fc5e5e'}" v-if="actInfo.isNeedChild && packagePayArray.length>0">{{ smallPerson.price }}/人（套餐价）</span>-->
            <span>{{ smallPerson.num }}人</span>
          </div>
          <div class="buy-right">
            <div class="buy-count">
              <button
                v-if="false"
                :style="{background:'#ececec',color:'#b8b8b8'}"
                @click="reduceSmall()"
              >-</button>
              <span :style="{color:'#fc5e5e'}">
              <span style="">{{ smallPerson.price }}元/人</span>
              <span
                :style="{color:'#fc5e5e'}"
                v-if="packagePayArray.length>0"
              >(套餐价)</span>
              <span v-if="actInfo.prePay"> （定金¥{{actInfo.preChildPrice?actInfo.preChildPrice:actInfo.prePay}}）</span>
            </span>
              <button
                v-if="false"
                :style="{background:'#afe9f1',color:'#02bad3'}"
                @click="addSmall()"
              >+</button>
            </div>
          </div>
        </div>
        <div class="buy-smallpeople" v-if="smallPerson.price==0">
          <div class="buy-left">
            <span>儿童</span>
            <!-- <span :style="{color:'#fc5e5e'}" v-if="actInfo.isNeedChild && !packagePayArray.length>0">{{ smallPerson.price }}/人</span>
            <span :style="{color:'#fc5e5e'}" v-if="actInfo.isNeedChild && packagePayArray.length>0">{{ smallPerson.price }}/人（套餐价）</span>-->
            <span>{{ smallPerson.num }}人</span>
          </div>
          <div class="buy-right">
            <div class="buy-count">
              <button
                v-if="false"
                :style="{background:'#ececec',color:'#b8b8b8'}"
                @click="reduceSmall()"
              >-</button>
              <span :style="{color:'#fc5e5e'}">
                {{ bigPerson.price }}元/人
                <span
                  :style="{color:'#fc5e5e'}"
                  v-if="packagePayArray.length>0"
                >(套餐价)</span>
              </span>
              
              <button
                v-if="false"
                :style="{background:'#afe9f1',color:'#02bad3'}"
                @click="addSmall()"
              >+</button>
            </div>
          </div>
        </div>
        <div class="item" v-for="(item,index) in orderItemlist" :key="index">
          <div class="mid">
            <van-cell :title="item.label"  :value="item.value" />
          </div>
        </div>
      </div>
    </div>

    <!-- 其他信息 -->
    <!-- <div class="together-info" v-if="enrollOption.need_assemble || enrollOption.need_group"> -->
    <div class="together-info">
      <div class="together-title">其他信息</div>
      <div class="together-box">
        <div class="group">
          <group v-if="true" gutter="0" @group-footer-title-margin-top="0">
            <!-- <div class="jihe">
              <selector
                style="color: #333;font-size:14px;border:0"
                title="集合地:"
                label-width="6em"
                :options="assembles"
                v-model.trim="togetherInfo.place"
                v-if="enrollOption.need_assemble"
              ></selector>
            </div>-->
            <div class="huodongdangqi" v-if="enrollOption.need_group">
              <selector
                title="活动档期:"
                style="color: #333;font-size:14px;border:0"
                label-width="6em"
                placeholder="请选择活动档期"
                :options="groups"
                v-model.trim="togetherInfo.dangqi"
                v-if="enrollOption.need_group"
                @on-change="changeGroups"
              ></selector>
            </div>
            <div class="buyer-message">
              <div class="buyer-box">
                <div class="left">买家留言</div>
                <div class="right">
                  <input type="text" v-model.trim="actJoinInfo.remark" placeholder="选填，请先和商家协商一致" />
                </div>
              </div>
            </div>
          </group>
        </div>
      </div>
    </div>

    <!-- 联系人信息 -->
    <div class="contact-info" v-if="false">
      <div class="contact-title">联系人信息</div>
      <div class="contact-box">
        <div class="name">
          <div class="left">联系人</div>
          <div class="inp">
            <input type="text" placeholder="请填写联系人" />
            <div class="tou">
              <img src="./detail/assets/img/order/lianxitou.png" alt />
            </div>
          </div>
        </div>
        <div class="phone">
          <div class="left">
            手机号码
            <!-- <div class="phone-select">选</div> -->
          </div>
          <div class="right">
            <div class="phone-inp">
              <input type="text" placeholder="请填写联系号码" />
            </div>
          </div>
        </div>
        <div class="weixin">
          <div class="left">微信昵称</div>
          <div class="weixin-inp">
            <input type="text" placeholder="请填写微信昵称" />
          </div>
        </div>
      </div>
    </div>

    <!-- 买家留言 -->
    <!-- <div class="buyer-message">
      <div class="buyer-box">
        <div class="left">买家留言</div>
        <div class="right">
          <input type="text" v-model.trim="actJoinInfo.remark" placeholder="选填，请先和商家协商一致" />
        </div>
      </div>
    </div>-->
    <!-- 报名须知 -->
    <div class="signup-tips">
      <div class="signup-title">报名须知</div>
      <div class="signup-box" v-html="actInfo.registNotice"></div>
    </div>
    <!-- 提交报名 -->
    <div class="sub">
      <div class="left">
        <span class="label" style="margin-right:4px">总价</span>
        <span class="value">
          <span class="fu">¥</span> {{orderInfo.needPay?orderInfo.needPay:0}}
        </span>
      </div>
      <div class="btn" @click="submitEnroll" :style="themeStyle" :disable="inPayment?true:false">提交报名</div>
    </div>
    <!-- 需要弹出来的日历控件 -->
    <van-calendar
      v-model.trim="moreCalendarFlag"
      @confirm="changeDay"
      :max-date="maxDate"
      :show-confirm="false"
      :color="themeStyle.backgroundColor"
      :formatter="formatter"
    />
    <!-- <div class="date-picker" v-show="moreCalendarFlag">
      <div class="close_bg" @click.stop="closeCalendar"></div>
      <div class="picker">
        <inline-calendar
          v-model.trim="actJoinInfo.selectDate"
          @on-change="changeDay"
          :disable-date-function="disableDate"
          :start-date="startDate"
          :disable-past="true"
          :highlight-weekend="true"
          :replace-text-list="{'TODAY':'今'}"
          :weeks-list="['日', '一', '二', '三', '四', '五', '六']"
        ></inline-calendar>
      </div>
    </div>-->
    <!-- 需要弹出来的人员增加module -->
    <div class="addPerson-modal" v-if="false">
      <!-- <div class="chosePerson-box">
        <div class="noPerson" v-if="enrollUsers.length == 0">现在还没有可以选择的报名人员，请添加</div>
        <div class="" v-for="(user,userIndex) in enrollUsers" :key="userIndex">
          <div class="check-line">
            <check-icon
              @click.native="checkClick(user)"
              class="check-style"
              :value.sync="user.isChecked"
              >{{user.name}}</check-icon>
            <div class="check-action-layout">
              <img
                class="check-action"
                src="../../assets/images/activity/act_enroll_del.png"
                @click="delModal(user, userIndex)"
              >
            </div>
          </div>
        </div>
        <div class="queren-box">
          <div class="" @click="closeAddModal" style="width:200px;height:40px;background:#3fbdff;border-radius:7px;color:#fff;font-size:14px;line-height:40px;text-align:center;margin:0 auto;" :style="themeStyle">确认选择</div>
        </div>
        <div class="need-more">
          <div @click="showAddPersonModal" style="color:#333;font-size:14px;height:40px;line-height:40px;margin: 0 auto;width:150px;text-align:center;display;flex;ali"><img style="vertical-align:middle;width:20px;height:20px;display:inline-block;line-height:40px;margin-right:5px" src="../../assets/images/activity/addbao.png" alt="">新增报名人员</div>
        </div>
        <div class="close-modal" @click="closeAddModal">
          <i class="iconfont icon-del"></i>
        </div>
      </div>-->
      <div
        class="addPerson-box"
        v-if="addPersonFlag"
        style="padding:0;width:90%;border-radius:10px;overflow: hidden;background:none;    height: 70%;
      "
      >
        <div
          class="title"
          style="height:45px;display: flex;align-items: center;background:#f8f8f8;padding:0 15px;box-sizing:border-box"
        >
          <div class="text" style="width:100px;height:20px;position:relative">
            <img src="./assets/img/edit_bg.png" alt style="width:100%;height:100%" />
            <span
              style="color:#fff;font-size:14px;font-weight:600;position:absolute;left:0;top:0;right:0;bottom:0;display: flex;justify-content: center;align-items: center"
            >填写信息</span>
          </div>
        </div>
        <div
          class="content"
          style="padding:0 15px;box-sizing:border-box;position:relative;background:#fff;    max-height: 80%;
        overflow: scroll;"
        >
          <!-- <img src="./assets/img/chi.png" alt="" style="width:100%;height:100%;position:absolute;left: 0;right: 0;bottom: 0;top: 0;"> -->
          <group v-if="isShowUserEdit" gutter="0px;">
            <x-input
              :title="'姓名:' + '<span' + ' ' + 'v-if=' +'info.require' +' '+ 'style=' + 'color:red' + '>*</span>'"
              :show-clear="false"
              label-width="6em"
              placeholder="请输入姓名"
              v-model.trim="user.name"
            ></x-input>
            <selector
              v-if="iid != 3062 && actInfo.isNeedChild"
              :title="'人员类型:' + '<span' + ' ' + 'v-if=' +'info.require' +' '+ 'style=' + 'color:red' + '>*</span>'"
              label-width="6em"
              placeholder="请选择人员类型"
              :options="[{key:1, value:'成人'}, {key:2, value:'儿童'}]"
              v-model.trim="user.adult"
            ></selector>
            <selector
              v-if="iid != 3062 && !actInfo.isNeedChild"
              :title="'人员类型:' + '<span' + ' ' + 'v-if=' +'info.require' +' '+ 'style=' + 'color:red' + '>*</span>'"
              label-width="6em"
              placeholder="请选择人员类型"
              :options="[{key:1, value:'成人'}]"
              v-model.trim="user.adult"
            ></selector>
            <selector
              :title="'性别:' + '<span' + ' ' + 'v-if=' +'info.require' +' '+ 'style=' + 'color:red' + '>*</span>'"
              label-width="6em"
              placeholder="请选择性别"
              :options="[{key:1, value:'男'}, {key:2, value:'女'}]"
              v-model.trim="user.sex"
            ></selector>
            <selector
              style="color: #333;font-size:14px;border:0"
              :title="'集合地:' + '<span' + ' '+ 'style=' + 'color:red' + '>*</span>'"
              label-width="6em"
              :options="assembles"
              v-model.trim="user.place"
              v-if="enrollOption.need_assemble"
            ></selector>

            <x-input
              :show-clear="false"
              :title="'手机号码:' + '<span' + ' ' + 'v-if=' +'info.require' +' '+ 'style=' + 'color:red' + '>*</span>'"
              label-width="6em"
              placeholder="请输入手机号码"
              v-model.trim="user.phone"
            ></x-input>
            <x-input
              :show-clear="false"
              :title="'身份证:' + '<span' + ' ' + 'v-if=' +'info.require' +' '+ 'style=' + 'color:red' + '>*</span>'"
              label-width="6em"
              placeholder="请输入身份证号码"
              v-model.trim="user.idCode"
              v-if="enrollOption.need_idCode"
            ></x-input>
            <!-- <div style="width:calc(100% - 16px);height:1px;background-color:#eee"></div> -->
            <!-- 其它必填字段 -->
            <div v-if="enrollOption.need_infos">
              <div v-for="info in user.infos" :key="info.name">
                <x-input
                  :show-clear="false"
                  v-if="info.name!='照片'"
                  :title="!!info.require ? info.name+':' + '<span' + ' ' + 'v-if=' +'info.require' +' '+ 'style=' + 'color:red' + '>*</span>' : info.name+':'"
                  label-width="6em"
                  v-model.trim="info.v"
                  :required="info.require"
                  :placeholder="info.ph"
                  class="photoupl"
                ></x-input>
                <div v-if="info.name=='照片' && remoteUrl" class="photou">
                  <cell :title="info.name +':' + '*' "></cell>
                  <Uploader
                    class="photo"
                    v-bind:url="remoteUrl"
                    :data="formData"
                    @success="uploadSuccess($event, info)"
                    @error="uploadError($event)"
                  ></Uploader>
                </div>
                <!-- <div
                  style="width:calc(100% - 16px);height:1px;background-color:#eee"
                ></div>-->
              </div>
            </div>

            <div v-for="(item, index) in user.addtionPayInfo" :key="index">
              <div class="check-Layout">
                <div class="check-title-layout" style="width:6em">{{item.title}}</div>
                <div
                  style="margin-left:105px;width:100px;line-height:40px;color:#646464;font-size:13px"
                >¥{{item.price}}</div>
                <x-switch
                  class="switch-layout"
                  title
                  v-model.trim="item.isSelected"
                  style="margin-left:auto"
                ></x-switch>
              </div>
              <!-- <div style="width:calc(100% - 16px);height:1px;background-color:#eee"></div> -->
            </div>

            <!-- <div class="btn-layout">
              <div></div>
              <div class="div-margin">
                <x-button type="primary" mini @click.native="saveUserInfo">保存信息再提交报名</x-button>
              </div>
            </div>-->
          </group>
        </div>
        <div class="juchi">
          <img src="./assets/img/juchi.png" alt style="width:100%;height:15px" />
        </div>
        <!-- 关闭增加人员模态 -->
        <div class="close-modal" @click="closeAddPersonModal">
          <i class="iconfont icon-del"></i>
        </div>

        <!-- <div class="btns" style="height:45px;width:100%;    display: flex;justify-content: center;align-items: center;margin-top:5px">
          <div @click="saveUserInfo" class="sub_btn" style="color:#fff;font-size:14px;font-weight:400;width:130px;height:40px;border-radius:40px;background:#5cc54f;    display: flex;justify-content: center; align-items: center;">保存信息</div>
        </div>-->
      </div>
      <div
        class="btns"
        style="height:45px;width:100%;    display: flex;justify-content: center;align-items: center;margin-top:5px;    position: absolute;
      bottom: 5%;
      z-index: 1000;"
      >
        <div
          @click="saveUserInfo"
          class="sub_btn"
          style="color:#fff;font-size:14px;font-weight:400;width:130px;height:40px;border-radius:40px;background:#5cc54f;    display: flex;justify-content: center; align-items: center;"
        >保存信息</div>
      </div>
    </div>
    <!-- 确定收否删除这个报名人 -->
    <div class="maydel" v-show="delFlag">
      <div class="del-box">
        <div class="tops">操作提示</div>
        <div class="sure">确定删除改联系人吗？</div>
        <div class="btns">
          <div class="btn-left" @click="delFlag = false">取消</div>
          <div class="btn-riht" @click="delUser">确定</div>
        </div>
      </div>
    </div>

    <!-- 绑定手机号弹窗 -->
    <bind-mobile v-if="bindMobileShow" @close="bindMobileDone"></bind-mobile>

    <!-- 粘贴 -->
    <van-dialog
      class="copy-text"
      v-model.trim="copyFlag"
      title="粘贴名单"
      show-cancel-button
      @confirm="sendCopyText"
    >
      <div class="box">
        <div class="tip" style="font-size:12px">格式（一行一个），胡某某，360XXXXXXX08013715，182XXXXXX44</div>
        <textarea
          style="white-space: pre-line;    font-size: 12px;"
          placeholder="请在此处粘贴名单"
          v-model.trim="copyText"
          name
          id
          cols="40"
          rows="10"
        ></textarea>
      </div>
    </van-dialog>
    <!-- <van-popup v-model.trim="copyFlag">
      <textarea name="" id="" cols="30" rows="10"></textarea>
    </van-popup>-->
    <transition name="van-slide-right">
      <div class="edit_user" v-if="addPersonFlag">
        <!-- 联系人列表 -->
        <div class="edit-list" v-if="!isShowUserEdit">
          <div class="add_btn">
            <div @click="copyFlag = true">
              <van-icon color="rgba(172,172,172,1)" size="13" name="plus" style="margin-right:5px" />粘贴名单
            </div>
            <div @click="showAddPersonModal">
              <van-icon color="rgba(172,172,172,1)" size="13" name="plus" style="margin-right:5px" />新增
            </div>
            
          </div>

          <div class="user_list">
            <div class="item" v-for="(user,userIndex) in enrollUsersCopy" :key="userIndex">
              <div class="name">
                <div class="left">
                  <div class="default" v-if="user.isDefault">默认</div>
                  {{user.name}}
                  <svg
                    @click="editUser(user,userIndex,2)"
                    t="1596511934334"
                    class="icon"
                    viewBox="0 0 1024 1024"
                    version="1.1"
                    xmlns="http://www.w3.org/2000/svg"
                    p-id="1655"
                    fill="rgb(72, 160, 241)"
                    width="30"
                    height="30"
                  >
                    <path
                      d="M326.1184 569.0624c-0.6912 0.896-1.3312 1.7664-1.6384 2.8672l-50.9952 193.024c-2.9696 11.2384 0.0512 23.3472 8.1408 31.872 5.9904 6.0672 13.9776 9.4208 22.4256 9.4208 2.7648 0 5.6064-0.3328 8.32-1.0752l185.6768-52.3008c0.2816 0 0.4352 0.2304 0.6912 0.2304 2.1248 0 4.224-0.7936 5.7856-2.4576L1001.088 238.2592c14.7712-15.2576 22.8352-36.0192 22.8352-58.5984 0-25.6-10.496-51.2-28.9536-70.1696l-46.8992-48.512c-18.4064-18.9952-43.2384-29.8752-68.0192-29.8752-21.888 0-41.984 8.32-56.8064 23.552L326.8608 567.296C326.3232 567.7824 326.5024 568.4992 326.1184 569.0624M952.5504 188.1088l-49.3056 50.8672-79.9744-83.8144 48.6144-50.2016c7.68-7.9616 22.5792-6.8096 31.3856 2.3808l46.9248 48.4608c4.864 5.0432 7.68 11.8016 7.68 18.4064C957.9008 179.6608 956.0064 184.5504 952.5504 188.1088M414.4128 577.1008 772.736 207.3088l79.9744 83.8912L495.0784 660.2752 414.4128 577.1008zM349.1072 727.04l25.9328-98.0992 69.0688 71.296L349.1072 727.04zM956.7744 391.168c-18.7904 0-35.3536 15.7696-35.4304 35.4304l0 479.4624c0 25.088-19.712 44.4672-44.032 44.4672L113.5872 950.528c-24.32 0-42.3936-19.4304-42.3936-44.4672L71.1936 116.9664c0-25.088 18.0736-43.9552 42.3936-43.9552l524.1344 0c18.8672 0 34.2528-17.3568 34.2528-36.8384s-15.3856-36.224-34.2528-36.224L108.3648-0.0512c-59.1616 0-108.3904 50.56-108.3904 111.6672l0 799.8208c0 61.1072 49.1776 112.512 108.3904 112.512l774.144 0c59.264 0 109.6448-51.4048 109.6448-112.512L992.1536 426.368C992.0768 406.912 975.5648 391.168 956.7744 391.168"
                      p-id="1656"
                    />
                  </svg>
                </div>
                <div class="right" @click="delModal(user,userIndex)">
                  <svg
                    t="1596509674727"
                    class="icon"
                    viewBox="0 0 1024 1024"
                    version="1.1"
                    xmlns="http://www.w3.org/2000/svg"
                    p-id="3203"
                    fill="#666"
                    width="18"
                    height="18"
                  >
                    <path
                      d="M517.59 21.609c-100.299 0-181.703 79.514-185.167 179.34H98.603c-25.979 0-47.235 21.099-47.235 47.236 0 25.98 21.099 47.237 47.236 47.237h52.117v528.416c0 99.196 67.233 180.285 150.37 180.285h423.55c82.98 0 150.37-80.616 150.37-180.285V295.737h47.236c25.98 0 47.236-21.1 47.236-47.237 0-25.98-21.099-47.236-47.236-47.236H702.441C699.449 101.124 617.888 21.61 517.59 21.61z m-96.677 179.34c3.464-51.172 45.19-90.85 96.834-90.85s93.37 39.835 96.362 90.85H420.913z m-119.98 714.842c-29.444 0-61.88-37.789-61.88-91.953V295.737h547.311V824.31c0 54.007-32.436 91.954-61.88 91.954H300.933v-0.473z m0 0"
                      p-id="3204"
                    />
                    <path
                      d="M364.387 802.267c21.57 0 39.363-21.571 39.363-48.653V476.022c0-27.082-17.635-48.654-39.363-48.654-21.572 0-39.364 21.572-39.364 48.654v277.592c0 26.924 17.32 48.653 39.364 48.653z m142.496 0c21.571 0 39.363-21.571 39.363-48.653V476.022c0-27.082-17.635-48.654-39.363-48.654-21.571 0-39.364 21.572-39.364 48.654v277.592c0 26.924 17.793 48.653 39.364 48.653z m149.896 0c21.571 0 39.364-21.571 39.364-48.653V476.022c0-27.082-17.635-48.654-39.364-48.654-21.571 0-39.363 21.572-39.363 48.654v277.592c0 26.924 17.162 48.653 39.363 48.653z m0 0"
                      p-id="3205"
                    />
                  </svg>
                </div>
              </div>
              <div class="item_info">
                <div class="info_left">
                  <div class="info_item">
                    <div class="label">性别</div>
                    <div class="value">{{user.sex==1?'男':'女'}}</div>
                  </div>
                  <div class="info_item">
                    <div class="label">手机号</div>
                    <div class="value">{{user.phone}}</div>
                  </div>
                  <selector
                    class="selector jihedi"
                    style="color: #333;font-size:14px;border:0"
                    :title="'集合地' + '<span' + ' '+ 'style=' + 'color:red' + '>*</span>'"
                    label-width="70px"
                    :options="assembles"
                    v-model.trim="user.place"
                    v-if="enrollOption.need_assemble"
                  ></selector>
                  <div class="info_item" @click="editUser(user,userIndex,2)">
                    <div class="tip tip_left">{{user | integrity}}</div>
                    <div class="tip tip_right" style="color:#999">{{user | integrity1}}</div>
                  </div>
                </div>
                <div class="info_right" @click="checkClick(user,userIndex)">
                  <svg
                    v-if="!user.isChecked"
                    t="1596512918652"
                    class="icon"
                    viewBox="0 0 1024 1024"
                    version="1.1"
                    xmlns="http://www.w3.org/2000/svg"
                    p-id="4346"
                    width="25"
                    height="25"
                  >
                    <path
                      d="M511.989255 128.273479c-211.841779 0-383.589398 171.805948-383.589398 383.725498s171.747619 383.726521 383.589398 383.726521c211.881688 0 383.608841-171.806971 383.608841-383.726521S723.870944 128.273479 511.989255 128.273479zM511.989255 865.644389c-195.223287 0-353.507266-158.322865-353.507266-353.645412 0-195.302081 158.283979-353.624946 353.507266-353.624946 195.263196 0 353.527732 158.323888 353.527732 353.624946C865.516987 707.321524 707.253474 865.644389 511.989255 865.644389z"
                      p-id="4347"
                    />
                  </svg>
                  <svg
                    v-if="user.isChecked"
                    t="1596512889438"
                    class="icon"
                    viewBox="0 0 1024 1024"
                    version="1.1"
                    xmlns="http://www.w3.org/2000/svg"
                    p-id="2399"
                    fill="#48a0f1"
                    width="30"
                    height="30"
                  >
                    <path
                      d="M510.976 866.304c-195.584 0-355.328-159.232-355.328-355.328s159.232-355.328 355.328-355.328 355.328 159.232 355.328 355.328-159.744 355.328-355.328 355.328z m0-658.432c-167.424 0-303.104 136.192-303.104 303.104S344.064 814.08 510.976 814.08 814.08 678.4 814.08 511.488s-136.192-303.616-303.104-303.616z"
                      p-id="2400"
                    />
                    <path
                      d="M457.728 599.552l-70.144-70.144c-10.24-10.24-10.24-27.648 0-37.888s27.648-10.24 37.888 0l70.144 70.144c10.24 10.24 10.24 27.648 0 37.888s-27.648 10.24-37.888 0z"
                      p-id="2401"
                    />
                    <path
                      d="M457.728 561.664l138.24-138.24c10.24-10.24 27.648-10.24 37.888 0s10.24 27.648 0 37.888l-138.24 138.24c-10.24 10.24-27.648 10.24-37.888 0-10.24-10.752-10.24-27.648 0-37.888z"
                      p-id="2402"
                    />
                  </svg>
                </div>
              </div>
            </div>
          </div>
          <div class="sure" @click="closeAddPersonFlag()">确定</div>
        </div>

        <!-- 编辑/新增联系人 -->
        <transition name="van-slide-right">
          <div class="edit-model" v-if="isShowUserEdit">
            <div class="item base_info">
              <div class="title">基本信息</div>
              <div class="info_inp_list">
                <group gutter="0px;" class="edit_group">
                  <x-input
                    :title="'姓名:' + '<span' + ' ' + 'v-if=' +'info.require' +' '+ 'style=' + 'color:red' + '>*</span>'"
                    :show-clear="false"
                    label-width="105px"
                    placeholder="请输入姓名"
                    v-model.trim="user.name"
                  ></x-input>
                  <selector
                    v-if="iid != 3062 && actInfo.isNeedChild"
                    :title="'人员类型:' + '<span' + ' ' + 'v-if=' +'info.require' +' '+ 'style=' + 'color:red' + '>*</span>'"
                    label-width="105px"
                    placeholder="请选择人员类型"
                    :options="[{key:1, value:'成人'}, {key:2, value:'儿童'}]"
                    v-model.trim="user.adult"
                  ></selector>
                  <selector
                    v-if="iid != 3062 && !actInfo.isNeedChild"
                    :title="'人员类型:' + '<span' + ' ' + 'v-if=' +'info.require' +' '+ 'style=' + 'color:red' + '>*</span>'"
                    label-width="105px"
                    placeholder="请选择人员类型"
                    :options="[{key:1, value:'成人'}]"
                    v-model.trim="user.adult"
                  ></selector>
                  <selector
                    :title="'性别:' + '<span' + ' ' + 'v-if=' +'info.require' +' '+ 'style=' + 'color:red' + '>*</span>'"
                    label-width="105px"
                    placeholder="请选择性别"
                    :options="[{key:1, value:'男'}, {key:2, value:'女'}]"
                    v-model.trim="user.sex"
                  ></selector>
                  <selector
                    v-show="false"
                    style="color: #333;font-size:14px;border:0"
                    :title="'集合地:' + '<span' + ' '+ 'style=' + 'color:red' + '>*</span>'"
                    label-width="105px"
                    :options="assembles"
                    v-model.trim="user.place"
                    v-if="enrollOption.need_assemble"
                  ></selector>

                  <x-input
                    :show-clear="false"
                    :title="'手机号码:' + '<span' + ' ' + 'v-if=' +'info.require' +' '+ 'style=' + 'color:red' + '>*</span>'"
                    label-width="6em"
                    placeholder="请输入手机号码"
                    v-model.trim="user.phone"
                  ></x-input>
                  <x-input
                    :show-clear="false"
                    :title="'身份证:' + '<span' + ' ' + 'v-if=' +'info.require' +' '+ 'style=' + 'color:red' + '>*</span>'"
                    label-width="105px"
                    placeholder="请输入身份证号码"
                    v-model.trim="user.idCode"
                    v-if="enrollOption.need_idCode"
                  ></x-input>
                  <!-- <div style="width:calc(100% - 16px);height:1px;background-color:#eee"></div> -->
                  <!-- 其它必填字段 -->
                  <div v-if="enrollOption.need_infos">
                    <div v-for="info in user.infos" :key="info.name">
                      <x-input
                        :show-clear="false"
                        v-if="info.name!='照片'"
                        :title="!!info.require ? info.name+':' + '<span' + ' ' + 'v-if=' +'info.require' +' '+ 'style=' + 'color:red' + '>*</span>' : info.name+':'"
                        label-width="105px"
                        v-model.trim="info.v"
                        :required="info.require"
                        :placeholder="info.ph"
                        class="photoupl"
                      ></x-input>
                      <div v-if="info.name=='照片' && remoteUrl" class="photou">
                        <cell :title="info.name +':' + '*' "></cell>
                        <Uploader
                          class="photo"
                          v-bind:url="remoteUrl"
                          :data="formData"
                          @success="uploadSuccess($event, info)"
                          @error="uploadError($event)"
                        ></Uploader>
                      </div>
                      <!-- <div
                        style="width:calc(100% - 16px);height:1px;background-color:#eee"
                      ></div>-->
                    </div>
                  </div>

                  <div v-show="false" v-for="(item, index) in user.addtionPayInfo" :key="index">
                    <div class="check-Layout">
                      <div class="check-title-layout" style="width:105px">{{item.title}}</div>
                      <div
                        style="margin-left:105px;width:100px;line-height:40px;color:#646464;font-size:13px"
                      >¥{{item.price}}</div>
                      <x-switch
                        class="switch-layout"
                        title
                        v-model.trim="item.isSelected"
                        style="margin-left:auto"
                      ></x-switch>
                    </div>
                    <!-- <div style="width:calc(100% - 16px);height:1px;background-color:#eee"></div> -->
                  </div>
                  <!-- 是否设置为默认字段 -->
                  <x-switch title="是否设置为默认" v-model.trim="user.isDefault"></x-switch>

                  <!-- <div class="btn-layout">
                    <div></div>
                    <div class="div-margin">
                      <x-button type="primary" mini @click.native="saveUserInfo">保存信息再提交报名</x-button>
                    </div>
                  </div>-->
                </group>
              </div>
            </div>
            <div class="sava_user" @click="saveUserInfo()">保存</div>
          </div>
        </transition>
      </div>
    </transition>

    <van-dialog class="paySuss"
      v-model.trim="erweimaFlag"
      title="支付成功"
      @confirm="confirm"
    >
      <img :src="erweimaImg">
    </van-dialog>

    <van-popup v-model.trim="choosePayFlag" round>
      <div class="choosePay">
        <div class="title">订单支付</div>
        <div class="pay-list">
          <van-radio-group v-model.trim="payType">
            <van-cell-group>
              <van-cell  clickable @click="payType = '2'">
                <template #title>
                  <img src="./assets/img/wechat.png" alt="" style="width:30px;height:30px">
                  <span>微信支付</span>
                </template>
                <template #right-icon>
                  <van-radio name="2" />
                </template>
              </van-cell>
              <van-cell  clickable @click="payType = '1'">
                <template #title>
                  <img src="./assets/img/alipay.png" alt="" style="width:30px;height:30px">
                  <span>支付宝支付</span>
                </template>
                <template #right-icon>
                  <van-radio name="1" />
                </template>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </div>
        <div class="pay-btn" @click="appPay()">去付款</div>
      </div>
    </van-popup>
  </div>
</template>

// 报名人员编辑所有css
<style lang="less">
::-webkit-scrollbar {
  display: none;
}
.weui-dialog {
  height: max-content;
}
.weui-cell_select .weui-cell__bd:after {
  -webkit-transform: rotate(0deg) !important;
  transform: rotate(0deg) !important;
}
.discount-list {
  .item {
    .mid {
      margin-left: 0 !important;
      .van-cell {
        padding: 0 !important;
        .van-cell__title {
          font-size: 14px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #666666;
        }
        .van-cell__value {
          font-size: 13px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: rgba(208, 208, 208, 1);
          &.usediscount{
            color: rgb(252, 94, 94);
          }
        }
        
      }
      &.switch{
        .van-field{
          display: flex;
          justify-content: space-between;
          .van-field__label{
            width: max-content;
            display: flex;
            align-items: center;
          }
          .van-field__value{
            margin-left: auto;
            width: max-content;
            display: flex;
            justify-content: flex-end;
            width: 42px;
            .van-field__body{
              width: max-content;
              width: 42px;
              .van-field__control{
                width: max-content;
                width: 42px;
              }
            }
          }
        }
      }
      
    }
  }
}
.edit_user {
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(243, 243, 243, 1);
  padding: 15px;
  box-sizing: border-box;
  overflow-y: scroll;
  .edit-list {
    height: 100%;
    position: relative;
    &:after {
      content: "";
      width: 5px;
      height: 0;
      position: absolute;
      right: 0;
      height: 100%;
      top: 0;
      background: #f3f3f3;
    }
  }
  .add_btn {
    width: 100%;
    height: 42px;
    background: rgba(255, 255, 255, 1);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: rgba(172, 172, 172, 1);
    position: absolute;
    z-index: 1;
    top: 0px;
    width: calc(~"100% - 5px");
    left: 0%;
    // transform: translateX(-50%);
    justify-content: space-between;
    div{
      width: 50%;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }
  .user_list {
    height: 100%;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    padding-top: 45px;
    padding-bottom: 70px;
    padding-right: 5px;
    overflow-x: hidden;
    box-sizing: border-box;
    .item {
      background: rgba(255, 255, 255, 1);
      border-radius: 10px;
      padding: 10px;
      box-sizing: border-box;
      margin-top: 10px;
      .name {
        display: flex;
        align-items: center;
        height: 30px;
        border-bottom: 1px dashed rgba(70, 159, 244, 0.5);
        .default {
          width: 29px;
          height: 17px;
          background: rgba(72, 160, 241, 1);
          border-radius: 2px;
          color: #fff;
          font-size: 12px;
          display: flex;
          justify-content: center;
          align-items: center;
          margin-right: 4px;
        }
        .left {
          font-size: 14px;
          font-family: PingFangSC-Medium, PingFang SC;
          font-weight: 500;
          color: rgba(51, 51, 51, 1);
          display: flex;
          align-items: center;
          svg {
            width: 18px;
            height: 18px;
            margin-left: 5px;
          }
        }
        .right {
          margin-left: auto;
        }
      }
      .item_info {
        padding-top: 8px;
        display: flex;
        .info_left {
          .info_item {
            display: flex;
            align-items: center;
            .label {
              font-size: 14px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: rgba(102, 102, 102, 1);
              width: 70px;
            }
            .value {
              font-size: 13px;
              font-family: PingFangSC-Medium, PingFang SC;
              font-weight: 500;
              color: rgba(51, 51, 51, 1);
            }
            .tip {
              color: red;
              font-size:12px;
              &.tip_left{
                -webkit-transform: scale(0.7);
                transform: scale(0.7);
                -webkit-transform-origin: 100% 100%;
                transform-origin: 0% 100%;
                left: 0;
                color: rgb(254, 0, 52);
              }
              &.tip_right{
                width:100%;
                -webkit-transform: scale(0.7);
                transform: scale(0.7);
                -webkit-transform-origin: 100% 100%;
                transform-origin: 100% 100%;
                left: 0;
                color: #ff976a;
              }
              

            }
          }
        }
        .info_right {
          // width: 50px;
          margin-left: auto;
          display: flex;
          justify-content: center;
          align-items: center;
        }
        .selector:before{
          height: 0!important;
          border:0!important;
        }
        .selector{
          // /deep/ {
            &.weui-cell:before{
              height: 0!important;
              border:0!important;
            }
            padding:0!important;
            .weui-select{
              height: 22px;
              line-height:22px;
            }
            .weui-label{
              font-size: 14px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: #666666;
              width: 70px;
            }
             &.weui-cell:before{
              height: 0;
            }
             .weui-cell__bd{
              width:150px;
              flex:0.7;
              position: relative;
            }
             .weui-select{
              width:150px;
              font-size: 13px;
            }
             .weui-select .weui-cell__bd:after{
              height:18px
            }
          // }
        }
      }
    }
  }
  .sure {
    width: calc(~"100% - 30px");
    height: 42px;
    background: rgba(72, 160, 241, 1);
    border-radius: 10px;
    font-size: 14px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: rgba(255, 255, 255, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    position: absolute;
    bottom: 20px;
    width: calc(~"100% - 5px");
    left: 0%;
    z-index:1
  }

  .edit-model {
    .base_info {
      background: rgba(255, 255, 255, 1);
      border-radius: 10px;
      padding: 10px;
      box-sizing: border-box;
      .title {
        height: 30px;
        display: flex;
        align-items: center;
        border-bottom: 1px dashed rgba(70, 159, 244, 0.5);
        font-size: 14px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: rgba(72, 160, 241, 1);
      }
      .info_inp_list .edit_group /deep/ {
        .weui-cells:before {
          height: 0;
          border: 0;
        }
        .weui-cells:after {
          height: 0;
          border: 0;
        }
        .weui-cell:before {
          height: 0;
          border: 0;
        }
        .vux-no-group-title {
          margin-top: 0 !important;
        }
        .weui-cells {
          margin-top: 0 !important;
        }
        .weui-cell {
          padding: 0 !important;
          height: 40px;
          display: flex;
          align-items: center;
          .weui-label {
            font-size: 14px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: rgba(102, 102, 102, 1) !important;
            width: 105px !important;
          }
          .weui-cell__ft {
            .weui-switch {
              height: 20px;
              border-radius: 10px;
            }
            .weui-switch:before {
              height: 18px;
              border-radius: 10px;
              // top: -1px;
              box-shadow: 0;
            }
            .weui-switch:after {
              height: 20px;
              border-radius: 10px;
              box-shadow: 0;
              top: -1px;
            }
          }
          .weui-cell__hd {
            font-size: 14px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: rgba(102, 102, 102, 1);
            width: 105px !important;
            .weui-label {
              font-size: 14px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: rgba(102, 102, 102, 1) !important;
              width: 105px !important;
            }
          }
          .weui-cell_switch {
            .weui-cell__bd {
              font-size: 14px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: #666 !important;
              width: 105px !important;
            }
          }
          .weui-cell__bd {
            input {
              font-size: 13px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: #333;
            }
            .weui-select {
              height: 40px !important;
              line-height: 40px;
            }
            select {
              font-size: 13px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: #333;
            }
            input::-webkit-input-placeholder {
              /* WebKit browsers */
              font-size: 13px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: rgba(208, 208, 208, 1);
            }
            input:-moz-placeholder {
              /* Mozilla Firefox 4 to 18 */
              font-size: 13px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: rgba(208, 208, 208, 1);
            }
            input::-moz-placeholder {
              /* Mozilla Firefox 19+ */
              font-size: 13px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: rgba(208, 208, 208, 1);
            }
            input:-ms-input-placeholder {
              /* Internet Explorer 10+ */
              font-size: 13px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: rgba(208, 208, 208, 1);
            }
          }
        }
      }
    }
    .sava_user {
      width: 100%;
      height: 42px;
      background: rgba(72, 160, 241, 1);
      border-radius: 10px;
      font-size: 14px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: rgba(255, 255, 255, 1);
      display: flex;
      justify-content: center;
      align-items: center;
      margin-top: 20px;
    }
  }
}
.choosePay{
  width:250px;
  height:300px;
  border-radius:20px;
  padding:20px;
  box-sizing: border-box;
  .title{
    font-size: 18px;
    font-weight: 500;
    height:40px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .pay-btn{
    height: 35px;
    font-size: 16px;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #06b4fd;
    margin-top: 40px;
  }
  .pay-list{
    padding-top:25px;
    .van-hairline--top-bottom::after, .van-hairline-unset--top-bottom::after {
        border-width: 0;
    }
    .van-cell{
      padding: 15px 16px;
    }
    .van-cell__title{
      display: flex;
      align-items: center;
      span{
        margin-left:10px
      }
    }
  }
}
</style>

<script>
import store from "store";
import walker from "@/common/walker";
import objectAssign from "object-assign";
import ossService from "SERVICE/app/ossService";
import actService from "SERVICE/app/actService";
import clientService from "SERVICE/app/clientService";
import wechatService from "SERVICE/app/wechatService";
import orderService from "SERVICE/app/orderService";

import BindMobile from "./BindMobile";
import NumberInput from "COMPONENT/Common/NumberInput";
import Uploader from "COMPONENT/Common/Uploader";
import "./detail/assets/iconfont/iconfont.css";
import "./detail/assets/newiconfont/iconfont.css";
import { Calendar,Toast } from "vant";
import { colorToRgb,loadJs, includeCss,isPhone,isCardID } from "@/libs/utils";
import moment from "moment";
import chi from "./assets/img/chi.png";
import weui from "weui.js";
// import "weui/dist/style/weui.min.css";
// import './assets/css/weui.css'
import {
  CheckIcon,
  XNumber,
  dateFormat,
  XHeader,
  Panel,
  Group,
  XInput,
  Selector,
  XTextarea,
  Box,
  XButton,
  InlineCalendar,
  Cell,
  XSwitch,
  InlineXSwitch
} from "vux";
import BScroll from "better-scroll";
const u = navigator.userAgent;
let pub = "";
export default {
  components: {
    CheckIcon,
    NumberInput,
    XNumber,
    XHeader,
    Panel,
    Group,
    XInput,
    Selector,
    XTextarea,
    Box,
    XButton,
    InlineCalendar,
    Uploader,
    Cell,
    XSwitch,
    BindMobile,
    Calendar,
    InlineXSwitch
  },
  data() {
    return {
      /** 页面信息 */
      page: {
        loading: true,
        isInApp: u.indexOf("Finger") !== -1 || u.indexOf("finger") !== -1, // 是否在app中
        isInWechat:
          u.indexOf("MicroMessenger") !== -1 && u.indexOf("wxwork") === -1, // 在普通微信中
        isInMiniprogram: window.__wxjs_environment === "miniprogram", // 是否在小程序中
        isAndroid: u.indexOf("Android") > -1 || u.indexOf("Linux") > -1, // 是否是安卓
        isIOS: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //是否是ios
        clientBridge: "",
        versionCode: "",
        appNavigationHeight: 0
      },
      /**判断的数据 */
      moreCalendarFlag: false, //是否显示更多日历
      copyFlag: false,
      copyText: "",
      moment: moment,
      calendarList: [
        //展示的日期列表
        {
          day: "10-12",
          tian: "明天",
          price: 480,
          disable: false
        },
        {
          day: "10-12",
          tian: "明天",
          price: 480,
          disable: false
        },
        {
          day: "10-12",
          tian: "明天",
          price: 480,
          disable: false
        },
        {
          day: "10-12",
          tian: "明天",
          price: 480,
          disable: false
        }
      ],
      delItem: "",
      delIndex: "",
      calendarSelect: -1, //选中的日期
      packageList: [
        //展示的套餐列表
        {
          title: "套餐一",
          desc: "两人团单人价"
        },
        {
          title: "套餐二",
          desc: "两人团单人价"
        },
        {
          title: "套餐三",
          desc: "两人团单人价"
        },
        {
          title: "套餐四",
          desc: "两人团单人价"
        }
      ],
      packageSelect: 0, //选中的套餐
      bigPerson: {
        //成人
        price: "0",
        num: 0
      },
      smallPerson: {
        //儿童
        price: "0",
        num: 0
      },
      togetherInfo: {
        //集合信息
        place: "",
        dangqi: ""
      },
      delFlag: false,
      addPersonFlag: false, //是否打开新增报名人员模态框
      enrollUsers: [], //报名人员列表
      enrollUsersCopy: [],
      userSelect: -1,
      enrollOption: {
        //是否需要这些字段
        need_idCode: false,
        need_assemble: false,
        need_group: false,
        need_infos: false
      },
      questinFlag: false,
      startDate: dateFormat(new Date(), "YYYY-MM-DD"),
      actJoinInfo: {
        //日历选中时间
        selectDate: ""
      },
      initGroup: "",
      /**数据 */
      iid: 1000,
      cid: 1000,
      activityId: 0,
      ossInfo: {},
      remoteUrl: null,
      formData: null,
      uploadImageUrl: null,
      ossInfo: {},
      remoteUrl: null,
      formData: null,
      uploadImageUrl: null,
      fieldMap: {
        name: "姓名",
        phone: "手机号码",
        idCode: "身份证",
        place: "集合地",
        adult: "人员类型",
        groupName: "档期"
      },
      tpl_enrollUser: {
        name: "",
        sex: "1",
        phone: "",
        idCode: "",
        place: "",
        adult: "1",
        groupName: ""
      },
      addtionPayInfo: [],
      packagePayArray: [], //套餐列表
      initGroup: "",
      actInfo: {},
      wxUserInfo: {},
      enrollNumber: 1,
      isShowGoods: false,
      goodsList: [],
      property: "",
      goodsSelectText: "挑选装备",
      user: {},
      isShowUserEdit: false,
      userEditType: 2,
      versionCode: 1,
      themeStyle: {
        "background-color": "#005ca1",
        "rgba":''
      },
      groupId: 0, //活动开团的组团ID
      bindMobileShow: false,
      maxDate: new Date(2020, 4, 31),
      chi: chi,
      isShowTip: false,
      period: "",
      //计算价格的参数
      orderInfo:{},//总计算数据
      price:0,
      proPrice:0,
      discountCode:'',//优惠码
      discountCodePrice:0,//优惠码价格
      chooseCoupon: {value:0,label:'不使用优惠券'},//选择的优惠券
      discountPrice:0,
      couponId:0,//使用的优惠券
      coninText:'',//积分抵扣信息
      isUseConin:false,//是否使用积分
      vipDiscount:{},//会员优惠展示
      orderItemlist:[],//订单明细
      unionId:'',
      openId:'',
      name:'',
      inPayment:false,//正在支付吗
      currentOrderId:'',
      erweimaFlag:false,
      erweimaImg:'',
      choosePayFlag:false,
      appPayOrderId:'',
      payType:'2',
      changeUsersFlag:false,
      needCalculate:false,//是否需要进行监听计算
      timeOut:''

    };
  },
  computed: {
    baseActInfo() {
      //活动信息
      if (this.actInfo.poster) {
        let tags = this.actInfo.tags;
        if (tags) tags = tags.split(",").join(" | ");
        return [
          {
            src: this.actInfo.poster + "@60w_60h_1e_1c.gif",
            title: this.actInfo.title,
            desc: tags || this.actInfo.shareDesc,
            url: `/app/act/${this.iid}/detail_test/${this.activityId}?cid=${this.cid}`
          }
        ];
      } else {
        return [
          {
            src: "/static/images/img_loading.png",
            title: "",
            desc: ""
          }
        ];
      }
    },
    assembles() {
      //集合地
      let result = ["选择集合地"];

      this.actInfo.assembleInfo.forEach(function(v) {
        result.push(v.address);
      });

      // console.log("result", result);
      return result;
    },
    groups() {
      //活动档期
      let result = [];
      this.actInfo.eventGroupInfo.forEach(function(v) {
        result.push(v.groupName);
      });
      return result;
    },
    couponNames() {
      let result = [{value:0,label:'不使用优惠券'}];
      if (this.orderInfo.coupons) {
        this.orderInfo.coupons.forEach(function(item) {
          result.push({
            value: item.id,
            label:
              item.desc +
              "("  +
              (item.discountType == 1
                ? "￥" + item.minusPrice
                : item.minusPrice + "折") +
              ")",
              discountType:item.discountType,
              minusPrice:item.minusPrice
          },
          );
        });
        if(result.length>1){
          this.chooseCoupon=result[1]
          this.couponId = result[1].value
        }
        
      }
      return result;
    },
  },
  created() {
    includeCss(
      "/static/css/weui.min.css"
    )

    pub = walker.get("pub");
    this.actInfo = store.get("actInfo");
    if (
      this.actInfo.subType == 2 ||
      this.actInfo.subType == 4 ||
      this.actInfo.subType == 5
    ) {
      this.calendarList = store.get("calendarList");
      this.calendarSelect = store.get("calendarSelect");
      this.period =
        this.$route.query.selectDate >= 0
          ? this.calendarList[this.calendarSelect].day
          : "";
    }
    // console.log(this.actInfo);
    this.maxDate = this.chooseType();
    if (this.actInfo && this.actInfo.travelInfos) {
      this.actInfo.travelInfos = JSON.parse(this.actInfo.travelInfos);
    }
    if (this.actInfo && this.actInfo.invalidDates) {
      this.actInfo.invalidDates = JSON.parse(this.actInfo.invalidDates);
    }
    // 解析主题色
    if (this.actInfo && this.actInfo.h5Color) {
      this.themeStyle.backgroundColor = this.actInfo.h5Color;
      this.themeStyle.rgba = colorToRgb(this.actInfo.h5Color,.7)
    }

    if (this.actInfo && this.actInfo.addtionPay) {
      //初始化附加价格
      var addInfos = JSON.parse(this.actInfo.addtionPay);
      for (var i = 0; i < addInfos.length; i++) {
        var addInfo = addInfos[i];
        if (!addInfo.isSelected) {
          addInfo.isSelected = false;
        }
        this.addtionPayInfo.push(addInfo);
      }
    }

    if (this.actInfo && this.actInfo.packagePay) {
      //初始化套餐列表
      var packagePays = JSON.parse(this.actInfo.packagePay);
      for (var i = 0; i < packagePays.length; i++) {
        var packageInfo = packagePays[i];
        // var optionText = packageInfo.title + "  ¥" + packageInfo.price;
        var optionText = packageInfo.title;
        var optionDic = {};
        optionDic.key = i + 1;
        optionDic.value = optionText;
        optionDic.price = "¥" + packageInfo.price;
        optionDic.childPrice = packageInfo.childPrice?packageInfo.childPrice:0
        this.packagePayArray.push(optionDic);
        console.log(this.packagePayArray);
      }
      if (this.packagePayArray.length > 0) {
        setTimeout(function() {
          let scrollEl = document.getElementById("scroll-wrap");
          let scrollwrap = document.getElementById("package-list");
          let width = document.documentElement.clientWidth;
          width = Number(width);
          width = width + 18;
          // scrollwrap.style.width = width + "px";
          new BScroll(scrollEl, {
            //滚动实例化
            scrollX: true,
            click: true
          });
        }, 100);
      }
      // console.log(this.packagePayArray);
    }
  },
  mounted() {
    Toast.loading({
      message: '加载中...',
      forbidClick: true,
      loadingType: 'spinner',
    });
    this.$nextTick(function() {
      this.groupId = store.get("groupId") || "";
      //URL的三个标准参数
      this.iid = this.$route.query.iid || 1000;
      this.cid = this.$route.query.cid || this.iid;
      this.activityId = this.$route.query.actId;

      if (!!this.$route.query.group) {
        var v = JSON.parse(this.$route.query.group);
        this.initGroup = v.groupName;
      }

      if (this.actInfo.goods && this.actInfo.goods.length > 0) {
        var goodsArr = this.actInfo.goods;
        for (var i = 0; i < goodsArr.length; i++) {
          var item = goodsArr[i];
          if (item.skus) {
            item.skus = JSON.parse(item.skus);
            var values = item.skus.values;
            var fields = item.skus.field;
            for (var value in values) {
              if (values.hasOwnProperty(value)) {
                var array = value.split("|");
                var feature = values[value];
                var newItem = objectAssign({}, item);

                newItem.sku = this.getStrValues(array);
                newItem.image = feature.images;
                newItem.number = feature.num;
                newItem.realPrice = feature.realPrice;
                newItem.property = this.getProperty(fields, array);
                this.goodsList[this.goodsList.length] = newItem;
              }
            }
          } else {
            var newItem = objectAssign({}, item);
            this.goodsList[this.goodsList.length] = newItem;
          }
        }
      }

      store.set("iid", this.iid);
      this.getOssParams();

      // 加载联系人
      this.getUserList();

      //如果活动信息未获取，则跳回活动详情
      if (!this.actInfo.id || this.actInfo.id != this.activityId) {
        this.gotoActDetail();
        return;
      }

      this.prepareEnrollFields();

      if (navigator.userAgent.indexOf("Finger") !== -1) {
        this.clientInit();
      }

      

      

      window.scrollTo(0, 0);
    });
    
    this.init();

    // console.log('period',JSON.parse(this.period))
    this.pushHistory();
    window.addEventListener("popstate", this.windowListener, false);
    // this.changeDay();
    // this.initBs();
    // console.log(this.actInfo.subType)
  },
  beforeDestroy() {
    window.removeEventListener("popstate", this.windowListener);
  },
  methods: {
    getConfigInfo(){
      orderService
        .getConfigList({ 
          iid:this.cid || this.iid,
          type:1,
          queryKey:'',
          pageNumber:1,
          pageSize:10
        })
        .then(
          data => {
            console.log(data);
            if(data.content && data.content.length>0){
              data.content.forEach((item,index) => {
                  if(item.name == '支付完成展示二维码'){
                    this.erweimaImg = item.remark
                    // console.log(this.erweimaImg)
                  }
              });
            }
            console.log('支付完成展示二维码',data)
          },
          error => {
            console.log(error);
          }
        );
    },
    confirm(){
      // this.$router.push({
      //   path: "/app/pay/order",
      //   query: {
      //     iid: this.cid || this.iid
      //   }
      // });
      this.$router.push({
        name: "buyShare",
        params:{
          iid:this.cid || self.iid,
        },
        query: {
          orderId: this.appPayOrderId
        }
      });
      // if(this.$route.query.iid == 3036){
      //   this.$router.push({
      //     name: "buyShare",
      //     params:{
      //       iid:this.cid || self.iid,
      //     },
      //     query: {
      //       orderId: this.appPayOrderId
      //     }
      //   });
      // }else{
      //   this.$router.push({
      //     path: "/app/pay/order",
      //     query: {
      //       iid: this.cid ||this.iid
      //     }
      //   });
      // }
    },
    wechatInit(callback) {
      let iid = this.cid || this.iid;
      wechatService.auth(
        iid,
        ({ openid, unionid, nickname }) => {
          if (!!openid && !!unionid) {
            this.unionId = unionid;
            this.openId = openid;
            this.name = nickname;
            wechatService.jsapi(iid, null, [
              "onMenuShareTimeline",
              "onMenuShareAppMessage",
              "chooseWXPay"
            ]);
            if (typeof callback === "function") callback();
          }
        },
        true
      );
    },
    searchCode(){//截流
    let val = this.discountCode
      val = val.replace(/\s*/g,"")//去除所有空格
      if(val.length==8){
       orderService.checkDiscountCode({
          iid:this.iid,
          userId:pub.userInfo.userId,
          // id:39,
          code:val
        }).then(res=>{
          if(!!res.data.usedTime){
            console.log('已经使用')
            this.$toast.fail('该优惠码已经被使用');
            return
          }
          this.discountCodePrice = res.data.price
        })
        .catch(err=>{
          //  this.$toast(err.msg)
           this.$toast('该优惠码不存在')

        })
        
        
        
      }else{
        this.discountCodePrice = ''
      }
      
      
    },
    parseExtraInfo() {

      //脏数据重新初始化
      if(this.orderInfo.coin && this.orderInfo.coinPercent){

      }else{
        this.coninText='',//积分抵扣信息
        this.isUseConin=false//是否使用积分
      }
      // if (this.orderInfo.disp2) {
      let items = [];
      // if (this.orderInfo.disp2) {
      //   this.orderInfo.disp2.forEach(function(item) {
      //     items.push({
      //       label: item.title,
      //       value: "￥" + item.price
      //     });
      //   });
      // }

      items = items.concat(this.orderInfo.priceDesc || []);//～～会员总价优惠

      // if (this.orderInfo.disp3 && this.orderType != 14) {
      //   this.orderInfo.disp3.forEach(function(item) {
      //     items.push({
      //       label: item.title + " x" + item.num,
      //       value: "￥" + item.price * item.num
      //     });
      //   });
      // }
      this.orderInfo.needPay= this.proPrice;
      let total = 0;
      if (
        this.isUseConin ||
        this.discountCodePrice ||
        this.couponId ||
        this.orderInfo.minusPrice ||
        (this.orderInfo.vipPercent > 0 && this.orderInfo.vipPercent < 1)
      ) {
        if (this.isUseConin) {
          total += this.orderInfo.coin * this.orderInfo.coinPercent;
        }
        if(this.discountCodePrice){
          total += this.discountCodePrice;
        }
        if (this.couponId) {
          for (let i = 0; i < this.orderInfo.coupons.length; i++) {
            if (this.orderInfo.coupons[i].id == this.couponId) {
              if (this.orderInfo.coupons[i].discountType == 1) {
                total += this.orderInfo.coupons[i].minusPrice;
              } else {
                total +=
                  (10 - this.orderInfo.coupons[i].minusPrice) *
                  0.1 *
                  this.proPrice;
              }
              break;
            }
          }
        }
        total += this.orderInfo.minusPrice;

        let vipDiscount = 0;
        if (this.orderInfo.vipPercent > 0 && this.orderInfo.vipPercent < 1) {
          vipDiscount = this.price * (1 - this.orderInfo.vipPercent);
        }
        total += vipDiscount;

        if (!Number.isInteger(total)) {
          total = total.toFixed(2);
        }

        // items.push({
        //   label: "优惠",
        //   value: "-￥" + total
        // });

        this.orderInfo.needPay -= total;
      }

      if (!this.isNeedInsur) {
        this.orderInfo.needPay -= this.orderInfo.inusrFee;
      }

      if (!Number.isInteger(this.orderInfo.needPay)) {
        this.orderInfo.needPay= this.orderInfo.needPay.toFixed(2);
      }

      if (this.orderInfo.needPay < 0) {//优惠后价格低于0那么需要支付0
        this.orderInfo.needPay = 0;
      }

      if (!!this.orderInfo.vipPercent && this.orderInfo.vipPercent<1) {//会员优惠
        items.push({
          label: "会员优惠",
          value:
            "-￥" + ((1 - this.orderInfo.vipPercent) * this.price).toFixed(2)
        });
        this.vipDiscount ={
          label: "会员优惠",
          value:
            "-￥" + ((1 - this.orderInfo.vipPercent) * this.price).toFixed(2)
        }
      }

      if (this.couponId) {//优惠券
        // 优惠券价格
        let discountPrice1 = 0;
        let discountType = 1
        for (let i = 0; i < this.orderInfo.coupons.length; i++) {
          if (this.orderInfo.coupons[i].id == this.couponId) {
            discountPrice1 = this.orderInfo.coupons[i].minusPrice;
            discountType= this.orderInfo.coupons[i].discountType
            break;
          }
        }
        console.log('discountPrice',(1-discountPrice1))
        items.push({
          label: "优惠券",
          value: "-￥" + (discountType==2?((10-discountPrice1)  *
                  0.1 *
                  this.proPrice).toFixed(2):discountPrice1)
        });
      }

      if (this.isUseConin) {//如果使用积分

          let discountPrice = 0;
          if(this.couponId){//如果使用优惠券
            for (let i = 0; i < this.orderInfo.coupons.length; i++) {
              if (this.orderInfo.coupons[i].id == this.couponId) {
                discountPrice = this.orderInfo.coupons[i].minusPrice;
                // alert(discountPric)
                break;
              }
            }
          }
          let kajain = 0
          console.log(this.orderInfo.priceDesc)
          if(this.orderInfo.priceDesc.length>0){
            this.orderInfo.priceDesc.forEach(item=>{
              kajain += item.value.split('¥')[1]
              console.log('inf0',item.value.split('¥')[1])
            })
          }
          console.log(kajain,discountPrice,(((1 - this.orderInfo.vipPercent) * this.price) || 0)+(this.discountCodePrice || 0))
          console.log((kajain + discountPrice+(((1 - this.orderInfo.vipPercent) * this.price) || 0)+(this.discountCodePrice || 0)),this.orderInfo.needPay,discountPrice)
          if((kajain + discountPrice+(((1 - this.orderInfo.vipPercent) * this.price) || 0)+(this.discountCodePrice || 0)) >this.orderInfo.needPay && false){
             
            items.push({
          label: "积分优惠",
          value:
            "-￥" +
            (this.orderInfo.coin * this.orderInfo.coinPercent - kajain - discountPrice-(((1 - this.orderInfo.vipPercent) * this.price) || 0)-(this.discountCodePrice || 0)).toFixed(2)
        });
          }else{
            items.push({
          label: "积分优惠",
          value:
            "-￥" +
            (this.orderInfo.coin * this.orderInfo.coinPercent).toFixed(2)
        });
          }
          
        // items.push({
        //   label: "积分优惠",
        //   value:
        //     "-￥" +
        //     (this.orderInfo.coin * this.orderInfo.coinPercent - kajain - discountPrice-(((1 - this.orderInfo.vipPercent) * this.price) || 0)-(this.discountCodePrice || 0)).toFixed(2)
        // });
      }
      if (this.discountCodePrice) {
        items.push({
          label: "优惠码优惠",
          value:
            "-￥" +
            (this.discountCodePrice).toFixed(2)
        });
      }
      this.orderItemlist = items;
      console.log('orderItemlist',this.orderItemlist)
      // } else {
      //   this.orderItemlist = [];
      // }
    },
    calculateOrder() {
      // if(this.changeUsersFlag) return

      let infos = []

      
      this.enrollUsers.forEach((item)=>{
        if(item.isChecked){
          infos.push(item)
        }
      })
      let selectedEnrollers = []
      for (var i = 0; i < infos.length; i++) {
        var member =infos[i];
        if (this.packagePayArray.length > 0 && member.packagePayNo > 0) {
          var  packageInfos= JSON.parse(this.actInfo.packagePay);
          member.packagePayInfo = packageInfos[member.packagePayNo - 1];
        }
        // if (member.isChecked) {//解决了选择第一个人人数为空
          selectedEnrollers.push(member);
        // }
      }
      console.log('infos',selectedEnrollers)
      infos =  selectedEnrollers

      let iid = this.$route.query.iid;
      let orderType = 4;
      let userId = pub.userInfo.userId;
      let keys = this.$route.query.actId;
      let property = JSON.stringify(infos);
      let property2 = this.period
      let num = 1;
      let isInApp = this.page.isInApp?1:0
      orderService
        .calculateOrder({ iid, num, orderType, userId, keys, property,property2,isInApp })
        .then( data=>{
          this.changeUsersFlag = false
          console.log('calcure',data)
          this.orderInfo = data
          this.price = data.totalPrice.toFixed(2)//总价
          this.proPrice = data.needPay.toFixed(2)//支付价

          if (this.orderInfo.coin && this.orderInfo.coinPercent) {
            this.coninText =
              "可用" +
              this.orderInfo.coin +
              "积分，" +
              "抵￥" +
              (this.orderInfo.coin * this.orderInfo.coinPercent).toFixed(2);
          }

          this.parseExtraInfo();
        }
          
        ).catch(error=>{

            
        })
    },
    createOrder(orderid) {
      if(navigator.userAgent.match(/MicroMessenger\//)) {
        this.wechatInit(() => {
          this.createOrderFn(orderid);
        });  
      }else {
        this.createOrderFn(orderid);
      }
    },
    createOrderFn(orderid) {
      if (this.inPayment === true) return;
      this.inPayment = true;
      const toast = Toast.loading({
        duration: 0, // 持续展示 toast
        forbidClick: true,
        message: '支付中',
      });
      setTimeout(() => {
        this.inPayment = false;
        Toast.clear();
      }, 3000);

      let ridSecret = store.get("ridSecret");
      let disrMultiDisKey = store.get("disrParentMultiDisKey");

      let infofo = {
          iid: this.cid || this.iid,
          orderType: 3,
          userId: this.openId,
          keys: orderid,
          isNeedInsur: 0,
          ridSecret: ridSecret,
          multiDisKey: disrMultiDisKey,
          queryUserId: 0,
          num: '',
          property: this.property,
          property2: this.property2 ? JSON.stringify(this.property2) : "",
          name: this.name ? this.name : "微信H5用户",
          phone: '',
          remark: '',
          couponId: this.couponId,
          useCoin: this.isUseConin,
          code: '',
          info: '',
          groupId: this.groupId,
          discountCode:this.discountCode,
          saleIid:this.$route.query.saleIid?this.$route.query.saleIid:'',
          saleR:this.$route.query.saleR?this.$route.query.saleR:''
      }
      console.log('infofo',infofo)
        // return
      orderService
        .createOrder({
          iid: this.cid || this.iid,
          orderType: 3,
          userId: this.openId,
          keys: orderid,
          isNeedInsur: 0,
          ridSecret: ridSecret,
          multiDisKey: disrMultiDisKey,
          queryUserId: 0,
          num: '',
          property: this.property,
          property2: this.property2 ? JSON.stringify(this.property2) : "",
          name: this.name ? this.name : "微信H5用户",
          phone: '',
          remark: '',
          couponId: this.couponId,
          useCoin: this.isUseConin,
          code: '',
          info: '',
          groupId: this.groupId,
          discountCode:this.discountCode,
          saleIid:this.$route.query.saleIid?this.$route.query.saleIid:'',
          saleR:this.$route.query.saleR?this.$route.query.saleR:''
        })
        .then(
          data => {
            this.currentOrderId = data;
            store.set("currentOrderId", this.currentOrderId);
            if (
              this.orderInfo.needPay === 0 ||
              this.orderInfo.totalPrice == 0
            ) {
              //付款为0，calculate接口会报错，所以这个条件不会满足
              window.location.replace(
                "/app/pay/order?iid=" +
                  (this.cid || this.iid) +
                  "&orderId=" +
                  data
              );
              return;
            } else {
              if(this.iid == 3036){
                this.appPayOrderId = data
                if(this.isInApp){
                  
                  this.choosePayFlag = true
                  return
                }
              }
              // console.log('data',data)
              this.payOrder(data,orderid);
            }
          },
          err => {
            console.log(err);
          }
        ).catch(err=>{
          // err => {
            this.$toast.fail(err.msg)
          // }
        })
    },
    appPay(){
      let bridge = window.WebViewJavascriptBridge
      if(bridge){
        bridge.callHandler("thirdPayOrder", {
          orderId: this.appPayOrderId,
          orderType:3,
          payWay:this.payType
        }, function () {});
      }
    },
    payOrder(orderId,orderid) {
      let self = this;
      let tradeType = "JSAPI";
      let isMiniprogram = false;
      if (window.__wxjs_environment === "miniprogram") {
        tradeType = "miniprogram";
        isMiniprogram = true;
      }
      if (isMiniprogram) {//小程序
        wx.miniProgram.navigateTo({
          url:
            "/pages/pay/pay?iid=" +
              (this.cid || this.iid) +
              "&rid=0&session=" +
              orderid +
              "&gid=" +
              orderId +
              "&channel=" +
              'act' +
              "&tradeType=" +
              tradeType +
              "&from=0" +
              "&tradeSubType=" +
              store.get("topic.type") || "" +
              "&saleIid" + (this.$route.query.saleIid?this.$route.query.saleIid:'') +
              "&saleR" + (this.$route.query.saleR?this.$route.query.saleR:'')
              ,
          success: function() {
            window.history.go(-1);
          }
        });
      } else if (navigator.userAgent.match(/MicroMessenger\//)) {
        orderService
          .createWechatOrder({
            iid: this.cid || this.iid,
            // tradeSubType: store.get('topic.type') || '',
            rid: 0,
            session: orderid,
            gid: orderId,
            channel: 'act',
            tradeType: tradeType,
            openid: this.unionId,
            saleIid:this.$route.query.saleIid?this.$route.query.saleIid:'',
            saleR:this.$route.query.saleR?this.$route.query.saleR:''
          })
          .then(
            data => {
              // alert(44)
              // console.log(`orderData:${JSON.stringify(data)}`);
              self.hideZanLoading$();
              wechatService.pay({
                data,
                cb: self.wxPayCallback
              });
            },
            err => {
              self.hideZanLoading$();
              self.$toast.fail(err.msg);
            }
          );
      } else {
        tradeType = "MWEB";
        orderService
          .createWechatOrder({
            iid: this.cid || this.iid,
            rid: 0,
            session: orderid,
            gid: orderId,
            channel: 'act',
            tradeType: tradeType,
            openid: this.unionId
          })
          .then(
            data => {
              // console.log(`orderData:${JSON.stringify(data)}`);
              self.hideZanLoading$();
              let mwebUrl = data["mwebUrl"];
              let localUrl = window.location.href;
              if (localUrl.indexOf("prompt=") == -1) {
                if (localUrl.indexOf("?") != -1) {
                  localUrl = window.location.href + "&prompt=1";
                } else {
                  localUrl = window.location.href + "?prompt=1";
                }
              }
              let addParam = "&redirect_url=" + encodeURIComponent(localUrl);
              // console.log("callUrl:" + mwebUrl + addParam);
              window.location.href = mwebUrl + addParam;
            },
            err => {
              self.hideZanLoading$();
              self.$toast.fail(err.msg);
            }
          );
      }
    },

    wxPayCallback(retStr) {
      let self = this;
      if (retStr == "success") {
        if(this.erweimaImg){
          this.erweimaFlag = true
        }else{
          weui.confirm("支付成功", {
          title: "提示",
          buttons: [
            {
              label: "确定",
              type: "primary",
              onClick: ()=> {
                self.$router.push({
                  name: "buyShare",
                  params:{
                    iid:self.cid || self.iid,
                  },
                  query: {
                    orderId: self.appPayOrderId
                  }
                });
                // if(self.$route.query.iid == 3036){
                //   self.$router.push({
                //     name: "buyShare",
                //     params:{
                //       iid:self.cid || self.iid,
                //     },
                //     query: {
                //       orderId: self.appPayOrderId
                //     }
                //   });
                // }else{
                //   self.$router.push({
                //     path: "/app/pay/order",
                //     query: {
                //       iid: self.cid || self.iid
                //     }
                //   });
                // }
                
              }
            }
          ],
          isAndroid: false
          });
          // weui.alert("支付成功", { isAndroid: false }, () => {
          //   self.$router.push({
          //       path: "/app/pay/order",
          //       query: {
          //         iid: self.cid || self.iid
          //       }
          //     });
          // });
        }
        
      } else if (retStr == "cancel") {
        this.$toast.fail("支付失败：用户取消支付");
        this.calculateOrder()
      } else if (retStr == "error") {
        this.$toast.fail("支付失败：未知错误");
        this.calculateOrder()
      } else {
        this.$toast.fail(`支付失败：${retStr}`);
        this.calculateOrder()
      }
    },
    selectCoupon() {
      weui.picker(this.couponNames, {
            onChange: function (result) {
                console.log(result);
            },
            onConfirm: (result)=> {
                this.chooseCoupon=result[0]
                this.couponId = result[0].value
                this.parseExtraInfo()
            },
            title: '选择优惠券'
        });
    },
    openAddPersonFlag() {
      this.enrollUsersCopy = JSON.parse(JSON.stringify(this.enrollUsers));
      this.addPersonFlag = true;
    },
    closeAddPersonFlag() {
      // this.needCalculate = true
      // setTimeout(()=>{
      //   this.needCalculate = false
      // },2000)
      this.enrollUsers = JSON.parse(JSON.stringify(this.enrollUsersCopy));
      this.addPersonFlag = false;
      console.log('enrollUsers',this.enrollUsers)
      this.$nextTick(()=>{
        this.calculateOrder()
      })
    },
    windowListener() {
      let that = this;
      if(this.userEditType == 1 && this.addPersonFlag && this.isShowUserEdit){
        this.isShowUserEdit = false;
        this.addPersonFlag = false;
        that.pushHistory();
        return
      }
      if (this.addPersonFlag && !this.isShowUserEdit) {
        this.addPersonFlag = false;
        that.pushHistory();
        return;
      }
      if (this.addPersonFlag && this.isShowUserEdit) {
        this.isShowUserEdit = false;
        this.addPersonFlag = true;
        that.pushHistory();
        return;
      }
      if (!this.addPersonFlag && !this.isShowUserEdit) {
        weui.confirm("确定要取消报名吗？", {
          title: "提示",
          buttons: [
            {
              label: "取消",
              type: "default",
              onClick: function() {
                that.pushHistory();
              }
            },
            {
              label: "确定",
              type: "primary",
              onClick: function() {
                that.$router.replace({
                  path: `/app/act/${that.$route.query.iid}/detail/${
                    that.$route.query.actId
                  }?saleR=${
                    that.$route.query.saleR ? that.$route.query.saleR : ""
                  }&disrParentMultiDisKey=${
                    that.$route.query.disrParentMultiDisKey
                      ? that.$route.query.disrParentMultiDisKey
                      : ""
                  }`
                });
              }
            }
          ],
          isAndroid: false
        });
      }
    },
    pushHistory() {
      let state = {
        title: "",
        url: window.location.href
      };
      window.history.pushState(state, state.title, state.url);
    },
    async sendCopyText() {
      console.log("sendtext", this.enrollUsersCopy);
      let user = objectAssign({}, this.tpl_enrollUser);
      console.log("user", user);
      // return
      if (this.copyText == "") {
        this.$toast.fail("请输入名单");
        return;
      }
      let result = await actService.sendCopyText({ content: this.copyText });
      console.log("result", result);

      if (!!result.length) {
        result.forEach((el, i) => {
          el = JSON.parse(JSON.stringify(el));
          el.birthday = this.getBirthdayFromIdCard(el.idCode);
          el.birthday = this.moment(el.birthday).valueOf();

          if (parseInt(el.idCode.substr(16, 1)) % 2 == 1) {
            el.sex = "1";
          } else {
            el.sex = "2";
          }

          let ages = this.getAge(el.idCode);
          let adult = 1;
          if (ages < 18) {
            adult = 2;
          }
          console.log(el);
         this.enrollUsersCopy.push({
            name: el.name,
            idCode: el.idCode,
            sex: el.sex,
            birthday: el.birthday,
            phone: el.phone,
            adult: adult,
            infos: user.infos,
            place: user.place
          });
          console.log();
        });
        // this.loading.close()
        this.copyFlag = false;
        this.copyText = ''
      } else {
        // this.loading.close()
        // this.$message.error(result.msg);
      }
    },
    getAge(UUserCard) {
      //获取年龄
      var myDate = new Date();
      var month = myDate.getMonth() + 1;
      var day = myDate.getDate();
      var age = myDate.getFullYear() - UUserCard.substring(6, 10) - 1;
      if (
        UUserCard.substring(10, 12) < month ||
        (UUserCard.substring(10, 12) == month &&
          UUserCard.substring(12, 14) <= day)
      ) {
        age++;
      }

      return age;
    },
    getBirthdayFromIdCard(idCard) {
      //根据身份证计算生日格式1997-00-00
      var birthday = "";
      if (idCard != null && idCard != "") {
        if (idCard.length == 15) {
          birthday = "19" + idCard.substr(6, 6);
        } else if (idCard.length == 18) {
          birthday = idCard.substr(6, 8);
        }

        birthday = birthday.replace(/(.{4})(.{2})/, "$1-$2-");
      }
      return birthday;
    },
    opneCopy() {},
    editUser(item, index, type) {
      this.user = JSON.parse(JSON.stringify(item));
      // this.user = item
      this.addPersonFlag = true;
      this.isShowUserEdit = true;
      this.userEditType = type;
      console.log(this.user);
      this.userSelect = index;
    },
    bindMobileDone(result, msg) {
      this.bindMobileShow = false;
      if (result === true) {
      }
      if (msg) {
        this.$toast(msg);
      }
    },
    /**
     * 初始化
     */
    async init() {
      // this.prepareEnrollFields();
      this.initStyle();
      
      try {
        if (this.packagePayArray.length > 0) {
          let packageList = JSON.parse(this.actInfo.packagePay);
          console.log('pac',packageList)
          this.bigPerson.price = packageList[this.packageSelect].price;
          if(packageList[this.packageSelect].childPrice){
             this.smallPerson.price = packageList[this.packageSelect].childPrice;
             this.smallPerson.childPrice = packageList[this.packageSelect].childPrice
          }else{
            this.smallPerson.price = packageList[this.packageSelect].price;
          }
         
        } else {
          this.bigPerson.price = this.calendarList[this.calendarSelect].price;
          this.smallPerson.price = this.calendarList[
            this.calendarSelect
          ].smallPrice;
        }
      } catch (error) {
        // this.$toast.fail("当前日期没有出团");
      }
      console.log('this.calendarList',this.calendarSelect)
    },
    changeGroups(val) {
      //切换活动档期
      // console.log('ooo',this.actInfo.eventGroupInfo)
      this.period = val
      if (this.packagePayArray.length > 0) {
        
      } else {
        for (let i = 0; i < this.actInfo.eventGroupInfo.length; i++) {
          if (val == this.actInfo.eventGroupInfo[i].groupName) {
            // console.log('quhhhhhhh')
            this.bigPerson.price = this.actInfo.eventGroupInfo[i].price;
            // if(this.actInfo.isNeedChild){
            //   this.smallPerson.price = this.actInfo.eventGroupInfo[i].childPrice
            // }else{
            //   this.smallPerson.price = this.actInfo.eventGroupInfo[i].price
            // }
            this.smallPerson.price = this.actInfo.eventGroupInfo[i].childPrice;
            this.smallPerson.childPrice = this.actInfo.eventGroupInfo[i].childPrice
          }
        }
      }
      this.calculateOrder()
    },
    /**
     * 初始化better-scroller
     */
    initBs() {
      // console.log('pac',this.packagePayArray)
      if (this.packagePayArray.length > 0) {
        //判断是否有套餐
        setTimeout(function() {
          let scrollwrap = document.getElementById("scrollwrap");
          let width = document.documentElement.clientWidth;
          width = String(width);
          width -= 18;
          scrollwrap.style.width = width + "px";
          new BScroll(scrollwrap, {
            //滚动实例化
            scrollX: true,
            click: true
          });
        }, 100);
      }
    },

    clientInit() {
      let that = this;
      clientService.auth(function(bridge) {
        //获取jsbridge
        that.clientBridge = bridge;
        that.isInApp = true;
        that.getAppInfo();
      });
    },

    getAppInfo() {
      var that = this;
      this.clientBridge.callHandler("getAppInfo", {}, function(data) {
        if (typeof data === "string") {
          data = JSON.parse(data);
          that.versionCode = data.appInfo.versionCode;
        }
      });
    },

    getPriceByDate() {
      for (var i = 0; i < this.actInfo.travelInfos.length; i++) {
        var item = this.actInfo.travelInfos[i];
        var d = dateFormat(new Date(item.t1), "YYYY-MM-DD");
        if (d == this.actJoinInfo.selectDate) {
          var result = "成人￥" + item.t2;
          if (item.t3) {
            result += "，儿童￥" + item.t3;
          }
          return result;
        }
      }
      return "";
    },

    getNumber(number) {
      this.enrollNumber = number;
    },

    confirmGoodsSelect() {
      this.isShowGoods = false;
      this.property = [];
      var prop;
      var num = 0;
      for (var i = 0; i < this.goodsList.length; i++) {
        var item = this.goodsList[i];
        if (item.selectNum > 0) {
          num += item.selectNum;
          prop = {};
          this.property.push(prop);
          prop["id"] = item.id;
          prop["image"] = item.image;
          prop["num"] = item.selectNum;
          prop["title"] = item.title;
          prop["price"] = item.realPrice;
          if (item.property) {
            prop["property"] = item.property;
          }
        }
      }

      if (num > 0) {
        this.goodsSelectText = "已选择" + num + "件装备";
      } else {
        this.goodsSelectText = "挑选装备";
      }
    },

    getProperty(fields, array) {
      var property = {};
      for (var i = 0; i < fields.length; i++) {
        var f = fields[i];
        property[f] = array[i];
      }
      return property;
    },

    getStrValues(array) {
      var sku = "";
      for (var i = 0; i < array.length; i++) {
        sku += array[i];
        if (i != array.length - 1) {
          sku += " ";
        }
      }
      return sku;
    },

    showGoodsList() {
      this.isShowGoods = true;
    },
    /**
     * 选中更多日期
     */
    getMoreDate() {
      this.moreCalendarFlag = true;
    },
    /**
     * 关闭日历
     */
    closeCalendar() {
      this.moreCalendarFlag = false;
    },
    /**
     * 选中日期(最终提交的actJoinInfo.selectDate日期要变为这里的)
     */
    selectCalendar(index, item) {
      if (item.disable) {
        this.$dialog.alert({ message: "该日期没有排期" });
        return false;
      }
      // console.log('item',item);
      this.calendarSelect = index;
      if (this.packagePayArray.length > 0) {
        let packageList = JSON.parse(this.actInfo.packagePay);
        this.bigPerson.price = packageList[this.packageSelect].price;
        this.smallPerson.price = packageList[this.packageSelect].price;
        if(packageList[this.packageSelect].childPrice){
            this.smallPerson.price = packageList[this.packageSelect].childPrice;
            this.smallPerson.childPrice = packageList[this.packageSelect].childPrice
        }else{
          this.smallPerson.price = packageList[this.packageSelect].price;
        }
      } else {
        this.bigPerson.price = item.price;
        this.smallPerson.price = item.smallPrice;
      }

      // this.actJoinInfo.selectDate = item.day
    },
    /**
     * 日历选中和初次加载
     */
    changeDay(date) {
      this.actJoinInfo.selectDate = date;
      console.log(date);
      console.log(this.actInfo.subType);
      if (
        this.actInfo.subType == 2 ||
        this.actInfo.subType == 4 ||
        this.actInfo.subType == 5
      ) {
        //需要左日期选择才执行下面的
      } else {
        // return false
        if (this.packagePayArray.length > 0) {
          let packageList = JSON.parse(this.actInfo.packagePay);
          // console.log('pac',packageList)
          this.bigPerson.price = packageList[this.packageSelect].price;
          // this.smallPerson.price = packageList[this.packageSelect].price;
          if(packageList[this.packageSelect].childPrice){
             this.smallPerson.price = packageList[this.packageSelect].childPrice;
             this.smallPerson.childPrice = packageList[this.packageSelect].childPrice
          }else{
            this.smallPerson.price = packageList[this.packageSelect].price;
          }
        }
        return false;
      }
      this.calendarSelect = -1; //换了日期就初始化选中的日期
      let time =
        new Date(this.actJoinInfo.selectDate).getTime() || new Date().getTime(); //选中的日期转为时间戳 或者今天转为时间戳
      if (this.actInfo.subType == 5) {
        // console.log(this.actInfo.travelInfos);
        // 根据日期
        for (let i = 0; i < this.calendarList.length; i++) {
          // console.log("i", i);
          this.calendarList[i].day = dateFormat(
            time + i * 86400000,
            "YYYY-MM-DD"
          );
          this.calendarList[i].tian = new Date(time + i * 86400000).getDay();
          for (let j = 0; j < this.actInfo.travelInfos.length; j++) {
            // console.log("j", j);
            let item = this.actInfo.travelInfos[j];
            let d = dateFormat(new Date(item.t1), "YYYY-MM-DD");
            this.calendarList[i].disable = true;
            this.calendarList[i].price = item.t2;
            if (this.calendarList[i].day === d) {
              this.calendarList[i].disable = false;
              this.calendarList[i].price = item.t2;
              if (this.actInfo.isNeedChild) {
                this.calendarList[i].smallPrice = item.t3;
              } else {
                this.calendarList[i].smallPrice = item.t2;
              }
              break;
            }
          }
        }
      } else {
        //周末周日
        for (let i = 0; i < this.calendarList.length; i++) {
          this.calendarList[i].day = dateFormat(
            time + i * 86400000,
            "YYYY-MM-DD"
          );
          this.calendarList[i].tian = new Date(time + i * 86400000).getDay();
          let day = this.calendarList[i].tian;
          console.log("day", day);
          if (this.calendarList[i].tian == 0) {
            //修复周末为0的差异
            day = 7;
          }
          if (this.actInfo.subTags[day - 1] == 0) {
            this.calendarList[i].price = this.actInfo.cost;
            this.calendarList[i].disable = true;
            if (this.actInfo.isNeedChild) {
              this.calendarList[i].smallPrice = this.actInfo.childPrice;
            } else {
              this.calendarList[i].smallPrice = this.actInfo.cost;
            }
          } else {
            this.calendarList[i].price = this.actInfo.cost;
            if (this.actInfo.isNeedChild) {
              this.calendarList[i].smallPrice = this.actInfo.childPrice;
            } else {
              this.calendarList[i].smallPrice = this.actInfo.cost;
            }
            this.calendarList[i].disable = false;
          }
        }
      }

      for (let i = 0; i < this.calendarList.length; i++) {
        //默认切换一天
        if (this.calendarList[i].disable == false) {
          this.calendarSelect = i;
          break;
        } else {
          this.calendarSelect = -1;
        }
      }
      try {
        if (this.packagePayArray.length > 0) {
          let packageList = JSON.parse(this.actInfo.packagePay);
          // console.log('pac',packageList)
          this.bigPerson.price = packageList[this.packageSelect].price;
          // this.smallPerson.price = packageList[this.packageSelect].price;
          if(packageList[this.packageSelect].childPrice){
             this.smallPerson.price = packageList[this.packageSelect].childPrice;
             this.smallPerson.childPrice = packageList[this.packageSelect].childPrice
          }else{
            this.smallPerson.price = packageList[this.packageSelect].price;
          }
        } else {
          this.bigPerson.price = this.calendarList[this.calendarSelect].price;
          this.smallPerson.price = this.calendarList[
            this.calendarSelect
          ].smallPrice;
        }
      } catch (error) {
        this.$toast.fail("当前日期没有出团");
      }

      // console.log("new", this.calendarList);
      this.closeCalendar();
    },
    /**
     * 选中套餐
     */
    selectPackage(index) {
      this.packageSelect = index;
      for (let i = 0; i < this.enrollUsers.length; i++) {
        //修改提交的套餐选择
        let item = this.enrollUsers[i];
        item.packagePayNo = index + 1;
      }
      if (this.packagePayArray.length > 0) {
        let packageList = JSON.parse(this.actInfo.packagePay);
        // console.log('pac',packageList)
        this.bigPerson.price = packageList[this.packageSelect].price;
        // this.smallPerson.price = packageList[this.packageSelect].price;
        if(packageList[this.packageSelect].childPrice){
            this.smallPerson.price = packageList[this.packageSelect].childPrice;
            this.smallPerson.childPrice = packageList[this.packageSelect].childPrice
        }else{
          this.smallPerson.price = packageList[this.packageSelect].price;
        }
      }
      // console.log('pacuser',this.enrollUsers)
      this.calculateOrder()
    },
    uploadSuccess(res, info) {
      info.v = res.previewUrl;
      // console.log("info:" + JSON.stringify(info));
      console.log("上传成功");
    },

    uploadError(res) {
      console.log("上传失败");
    },
    /**
     * 成人数量减少
     */
    reduceBig() {
      if (this.bigPerson.num == 0) {
        return false;
      }
      this.bigPerson.num--;
    },
    /**
     * 成人数量减增加
     */
    addBig() {
      this.bigPerson.num++;
    },
    /**
     * 儿童数量减少
     */
    reduceSmall() {
      if (this.smallPerson.num == 0) {
        return false;
      }
      this.smallPerson.num--;
    },
    /**
     * 删除提示确认
     */
    delModal(item, index) {
      // this.delFlag = true
      this.delItem = item;
      this.delIndex = index;

      weui.confirm("确定要删除该联系人吗？", {
        title: "提示",
        buttons: [
          {
            label: "取消",
            type: "default",
            onClick: function() {}
          },
          {
            label: "确定",
            type: "primary",
            onClick: () => {
              this.delUser();
            }
          }
        ],
        isAndroid: false
      });
    },
    /**
     * 儿童数量增加
     */
    addSmall() {
      this.smallPerson.num++;
    },
    /**
     * 游客信息使用说明
     */
    showQuestion() {
      this.questinFlag = !this.questinFlag;
    },
    /**
     * 初始化报名拓展
     */
    prepareEnrollFields() {
      //初始化报名的扩展选项
      //是否需要身份证
      this.enrollOption.need_idCode = !!this.actInfo.isNeedIdCode;
      if (!this.enrollOption.need_idCode) {
        delete this.tpl_enrollUser.idCode;
      }
      //是否需要集合地
      // this.enrollOption.need_assemble = this.actInfo.subType != 3 && !!this.actInfo.assembleInfo.length
      this.enrollOption.need_assemble = !!this.actInfo.assembleInfo.length;
      if (!this.enrollOption.need_assemble) {
        delete this.tpl_enrollUser.place;
      } else {
        this.tpl_enrollUser.place = this.actInfo.assembleInfo[0].address
          ? this.actInfo.assembleInfo[0].address
          : "选择集合地"; //this.actInfo.assembleInfo[0].address;
        this.togetherInfo.place = this.actInfo.assembleInfo[0].address
          ? this.actInfo.assembleInfo[0].address
          : "选择集合地"; //添加的方法
      }
      //是否需要活动档期
      this.enrollOption.need_group = this.actInfo.subType == 3;
      // console.log('group',this.enrollOption.need_group)
      if (!this.enrollOption.need_group) {
        delete this.tpl_enrollUser.groupName;
      } else {
        this.tpl_enrollUser.groupName = this.groups[0];
        this.togetherInfo.dangqi = this.groups[0]; //添加的方法
        // this.user.groupName = this.groups[0]
        if (this.actInfo.subType === 3) {
          //如果不判断普通活动会出现错误提示
          if (this.initGroup) {
            this.tpl_enrollUser.groupName = this.initGroup;
            this.togetherInfo.dangqi = this.initGroup;
          } else {
            this.tpl_enrollUser.groupName = this.groups[0];
            this.togetherInfo.dangqi = this.groups[0];
          }
        }
        if (this.$route.query.group) {
          this.period = this.tpl_enrollUser.groupName;
        } else if (
          this.actInfo.subType == 2 ||
          this.actInfo.subType == 4 ||
          this.actInfo.subType == 5
        ) {
        }
      }
      //是否有补充字段
      this.enrollOption.need_infos = !!this.actInfo.needInfos.need.length;
      if (this.enrollOption.need_infos) {
        //把补充字段准备好
        var infos = [];
        this.actInfo.needInfos.need.forEach(function(need) {
          if (need.hasOwnProperty("require")) {
          } else {
            need.require = true;
          }
          infos.push(objectAssign({ v: "" }, need));
          console.log("need", need);
        });
        this.tpl_enrollUser.infos = infos;
      }

      if (this.addtionPayInfo && this.addtionPayInfo.length > 0) {
        var checkInfos = [];
        for (let i = 0; i < this.addtionPayInfo.length; i++) {
          var infoDic = {};
          Object.assign(infoDic, this.addtionPayInfo[i]);
          checkInfos.push(infoDic);
        }
        // console.log('ad',this.addtionPayInfo)
        this.tpl_enrollUser.addtionPayInfo = checkInfos;
      }
    },
    chooseType() {
      // console.log(new Date(2020, 4, 31))
      // var time1 = GetXFormFieldById("fd_34def0c182299e");
      // var time2 = GetXFormFieldById("fd_34def0c23deb00");
      var str = ""; //原文本格式"2015-05-26";

      // 转换文本的日期格式
      // str = str.replace(/-/g, '/'); // 转为格式"2015/05/26";
      // 创建日期对象，并初始化，完成文本转日期
      var date = new Date();

      //日期转文本方式一：
      str =
        date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
      console.log(str);
      var year = date.getFullYear(); //年
      var month = date.getMonth() + 6; //月 +6个月  因为js里month从0开始，所以要加1
      if (month > 12) {
        year++;
        month -= 12;
      }
      if (month < 10) {
        month = "0" + month;
      }
      var date2 = new Date(year, month, 0); //新的年月
      var day1 = date.getDate();
      var day2 = date2.getDate();
      if (day1 > day2) {
        //防止+6月后没有31天
        day1 = day2;
      }
      str = year + "-" + month + "-" + day1;
      console.log(str);
      let strArr = str.split("-");
      console.log(strArr);
      let returnStr = new Date(strArr[0], strArr[1], strArr[2]);
      console.log(returnStr);
      return returnStr;
      //最后赋值文本框显示
      // time2[0].value = str;
    },
    formatter(day) {
      let MyDate = new Date();
      let today =
        MyDate.getFullYear() +
        "-" +
        (MyDate.getMonth() + 1) +
        "-" +
        MyDate.getDate();
      let todayArr = today.split("-");
      // console.log(dateFormat(new Date(day.date), "YYYY-MM-DD"))
      const month = day.date.getMonth() + 1;
      const date = day.date.getDate();
      const week = day.date.getDay();
      // console.log(dateFormat(new Date(day.date), "YYYY-MM-DD"),week)
      // console.log(4 == '04')
      if (month == todayArr[1]) {
        if (date == todayArr[2]) {
          day.text = "今天";
        }
      }
      if (this.actInfo.subType == 5) {
        //根据日期
        for (var i = 0; i < this.actInfo.invalidDates.length; i++) {
          var item = this.actInfo.invalidDates[i];
          // var d = dateFormat(new Date(item.t1), "YYYY-MM-DD");
          if (item == dateFormat(new Date(day.date), "YYYY-MM-DD")) {
            // console.log(item,'==')
            day.type = "disabled";
            return day;
            // console.log(8888)
          }
        }
      } else {
        var weekDay = 0;
        if (day.date.getDay() == 0) {
          weekDay = 7;
        } else {
          weekDay = day.date.getDay();
        }
        if (this.actInfo.subTags[weekDay - 1] == 0) {
          // return true;
          day.type = "disabled";
        }
      }

      // if (month === 5) {
      //   if (date === 1) {
      //     day.topInfo = '劳动节';
      //   } else if (date === 4) {
      //     day.topInfo = '青年节';
      //   } else if (date === 11) {
      //     day.text = '今天';
      //   }
      // }

      // if (day.type === 'start') {
      //   day.bottomInfo = '入住';
      // } else if (day.type === 'end') {
      //   day.bottomInfo = '离店';
      // }

      return day;
    },
    /**
     * 日历禁止点击(完美)
     */
    disableDate(date) {
      if (this.actInfo.subType == 5) {
        //根据日期
        for (var i = 0; i < this.actInfo.travelInfos.length; i++) {
          var item = this.actInfo.travelInfos[i];
          var d = dateFormat(new Date(item.t1), "YYYY-MM-DD");
          if (d == date.formatedDate) {
            return false;
          }
        }
        return true;
      } else {
        var weekDay = 0;
        if (date.weekDay == 0) {
          weekDay = 7;
        } else {
          weekDay = date.weekDay;
        }
        if (this.actInfo.subTags[weekDay - 1] == 0) {
          return true;
        }
      }
    },
    getOssParams() {
      let self = this;
      ossService.getOssParams().then(
        result => {
          self.ossInfo = result;
          var key = "h5/" + self.iid + "_" + new Date().getTime();
          self.remoteUrl = "https://fimage.oss-cn-shenzhen.aliyuncs.com/";
          var previewUrl = "https://fimage.huaxiyou.cc/";
          self.uploadImageUrl = previewUrl + key;
          self.formData = {
            key: key,
            policy: self.ossInfo.policy,
            OSSAccessKeyId: self.ossInfo.accessKeyId,
            success_action_status: "200", //让服务端返回200,不然，默认会返回204
            signature: self.ossInfo.sign,
            expire_time: self.ossInfo.expireTime
          };
          this.getConfigInfo()
        },
        error => {}
      );
    },
    /**
     * 去详情页
     */
    gotoActDetail() {
      this.$router.replace({
        path: `/app/act/${this.iid}/detail/${this.activityId}`,
        query: {
          cid: this.cid,
          saleIid: this.$route.query.saleIid ? this.$route.query.saleIid : ""
        }
      });
    },
    /**
     * 去prepay
     */
    gotoActPrepay(keys) {
      if (this.isInApp && this.versionCode >= 70) {
        var orderParam = {};
        orderParam.iid = this.iid;
        orderParam.orderType = 3;
        orderParam.userId = pub.userInfo.userId;
        orderParam.name = "";
        orderParam.phone = "";
        orderParam.property = keys;
        orderParam.keys = keys;
        orderParam.remark = this.actJoinInfo.remark;
        if (this.$route.query.saleIid) {
          orderParam.saleIid = this.$route.query.saleIid;
        }
        if (
          this.groupId &&
          typeof this.groupId === "number" &&
          this.groupId > 0
        ) {
          orderParam.groupId = this.groupId;
        }
        this.clientBridge.callHandler(
          "getCreatOrderData",
          orderParam,
          function() {}
        );
        return;
      }

      var prop = "";
      if (this.property && this.property.length > 0) {
        prop = JSON.stringify(this.property);
      }
      window.location.replace(
        "/app/pay/act?" +
          "iid=" +
          this.iid +
          "&id=" +
          this.activityId +
          "&cid=" +
          this.cid +
          "&keys=" +
          keys +
          "&property=" +
          prop +
          "&remark=" +
          (this.actJoinInfo.remark ? this.actJoinInfo.remark : "") +
          "&type=3" +
          (this.$route.query.saleIid
            ? "&saleIid=" + this.$route.query.saleIid
            : "") +
          "&saleR=" +
          (!!this.$route.query.saleR ? this.$route.query.saleR : "")
      );
    },
    /**
     * 选择modal中已有的报名人员
     */
    checkClick(user, index) {
      console.log(user);
      console.log(user.hasOwnProperty("isChecked"));
      // this.groupCellWillShow();
      if (!user.hasOwnProperty("isChecked")) {
        this.$set(this.enrollUsersCopy[index], "isChecked", true);
        // this.enrollUsers[index].isChecked = true
      } else if (user.hasOwnProperty("isChecked")) {
        this.$set(
          this.enrollUsersCopy[index],
          "isChecked",
          !this.enrollUsersCopy[index].isChecked
        );
        // this.enrollUsers[index].isChecked= !this.enrollUsers[index].isChecked
      }
      console.log(this.enrollUsersCopy);
      // this.enrollUser[index].isChecked = !this.enrollUser[index].isChecked
      // console.log(user)
      if (this.actInfo.subType === 4) {
        for (var i = 0; i < this.enrollUsersCopy.length; i++) {
          var enrollUser = this.enrollUsersCopy[i];
          if (user.isChecked && user.id != enrollUser.id) {
            enrollUser.isChecked = false;
          }
        }
      }
      // console.log('check')
      // for(let i=0;i<this.enrollUsers.length;i++){//默认选择第一个用户
      //     // console.log(this.enrollUsers[i].isChecked)
      //     if(this.enrollUsers[i].isChecked == true){
      //       // console.log('tong')
      //       this.userSelect = i
      //       break
      //     }
      // }
    },
    /**
     * 删除报名人员
     */
    delUser() {
      let user = this.delItem;
      let index = this.delIndex;
      this.enrollUsers[index].isChecked = false;
      this.enrollUsersCopy[index].isChecked = false;
      this.delFlag = false;
      actService
        .delEnrollUser({ userId: pub.userInfo.userId, id: user.id })
        .then(result => {
          // console.log(result);
          if (result.code == 0) {
            this.enrollUsers.splice(index, 1);
            this.enrollUsersCopy.splice(index, 1);
            this.calculateOrder()
            if(this.enrollUsers.length == 0){
              this.orderInfo.needPay = 0
            }
          }
          this.delFlag = false;
        });
    },
    /**
     * 检查用户信息
     */
    checkUser(index) {
      this.userSelect = index;
      // console.log('userselect',index)
    },
    /**
     * 获取userlist
     */
    getUserList() {
      actService
        .getEnrolledUserList({ userId: pub.userInfo.userId })
        .then(result => {
          // console.log('user',result);
          if (result.contacts && result.contacts.length > 0) {
            for (var i = 0; i < result.contacts.length; i++) {
              var item = result.contacts[i];
              if (item.infos) {
                // console.log('isInfos?')
                item.infos = JSON.parse(item.infos);
              }
              if (item.isDefault) {
                item.isChecked = true;
              } else {
                item.isChecked = false;
              }
              this.addEnrollUserByData(item);
              
            }

            //将默认的移动到第一项
            // this.enrollUsers.unshift(...this.enrollUsers.splice(this.enrollUsers.findIndex(i => {console.log(i); return i.isDefault == true}), 1))
            // const targetIndex = this.tpl_enrollUser.findIndex(v => v.isDefault == true);
            // [this.tpl_enrollUser[targetIndex], this.tpl_enrollUser[0]] = [this.tpl_enrollUser[0], this.tpl_enrollUser[targetIndex]]
            let needMove = [];
            let dontNeedMove = [];
            this.enrollUsers.forEach(el => {
              if (el.isDefault) {
                needMove.push(el);
              } else {
                dontNeedMove.push(el);
              }
            });
            this.enrollUsers = [...needMove, ...dontNeedMove];

            if (navigator.userAgent.match(/MicroMessenger\//)) {
              this.wechatInit(() => {
                this.calculateOrder();
              });
            } else {
              let unionid = store.get("unionId");
              this.unionId = unionid;
              this.openId = unionid;
              this.name = "微信外部网页用户";
              this.calculateOrder();
            }
            // console.log()
          }
        });
    },
    /**
     * 打开保存报名人员的框
     */
    showAddPersonModal() {
      console.log(this.user);
      this.user = objectAssign({}, this.tpl_enrollUser);
      console.log("添加报名信息");
      this.isShowUserEdit = true;
      this.addPersonFlag = true;
    },
    /**
     * 关闭保存报名人员的框
     */
    closeAddPersonModal() {
      // this.addPersonFlag = false
      this.isShowUserEdit = false;
      this.user = {};
      this.userSelect = -1;
    },
    /**
     * 保存报名人员信息（完美）
     */
    saveUserInfo() {
      this.addEnrollUserToList();
    },
    showUserEdit() {
      this.addEnrollUser();
      this.isShowUserEdit = true;
      // this.groupCellWillShow();
    },
    closeAddModal() {
      this.isShowUserEdit = false;
    },
    addEnrollUserByData(contact) {
      console.log("this.tpl_enrollUser", this.tpl_enrollUser);
      var user = objectAssign({}, this.tpl_enrollUser);
      // console.log('user',user)
      // console.log('this.actInfo.subType',this.actInfo.subType)
      if (this.actInfo.subType === 3) {
        //如果不判断普通活动会出现错误提示
        user.groupName = this.initGroup;
      }
      // console.log('infos',this.tpl_enrollUser.infos)
      if (this.tpl_enrollUser.infos) {
        user.infos = [];
        this.tpl_enrollUser.infos.forEach(function(info) {
          user.infos.push(objectAssign({}, info));
        });
      }

      user.id = contact.id;

      if (contact.nickName) {
        user.name = contact.nickName;
      }
      if (contact.sex) {
        user.sex = contact.sex;
      }
      if (!!contact.isDefault) {
        user.isDefault = true;
        user.isChecked = true;
      } else {
        user.isDefault = false;
        user.isChecked = false;
      }
      if (contact.mobile) {
        user.phone = contact.mobile;
      }
      if (contact.identifyId) {
        user.idCode = contact.identifyId;
      }
      if (contact.adult) {
        user.adult = contact.adult;
      }
      // user.place = ''
      if (user.infos && contact.infos) {
        user.infos.forEach(function(info) {
          for (var i in contact.infos) {
            var item = contact.infos[i];
            if (item.name == info.name) {
              info.v = item.v;
            }
          }
        });
      }
      if (this.addtionPayInfo && this.addtionPayInfo.length > 0) {
        var checkInfos = [];
        for (let i = 0; i < this.addtionPayInfo.length; i++) {
          var infoDic = {};
          Object.assign(infoDic, this.addtionPayInfo[i]);
          checkInfos.push(infoDic);
        }
        user.addtionPayInfo = checkInfos;
        // console.log('addtion',user.addtionPayInfo)
      }

      if (this.packagePayArray.length > 0) {
        user.packagePayNo = 1;
        this.packageSelect = 0;
      }

      // console.log(this.enrollUsers)

      this.enrollUsers.push(user);
    },
    addEnrollUser() {
      var user = objectAssign({}, this.tpl_enrollUser);
      if (this.actInfo.subType === 3) {
        //如果不判断普通活动会出现错误提示
        user.groupName = this.initGroup;
      }
      if (this.tpl_enrollUser.infos) {
        user.infos = [];
        this.tpl_enrollUser.infos.forEach(function(info) {
          user.infos.push(objectAssign({}, info));
        });
      }
      this.user = user;
    },
    editEnrollUser(user) {
      actService
        .editEnrollUser({
          id: user.id,
          userId: pub.userInfo.userId,
          nickName: user.name,
          sex: user.sex,
          mobile: user.phone,
          identifyId: user.idCode,
          adult: user.adult,
          isDefault: user.isDefault,
          infos: JSON.stringify(user.infos)
        })
        .then(result => {
          // console.log(result);
        });
    },
    /**
     * 添加报名人员进列表（完美）
     */
    addEnrollUserToList() {
      var isValid = true;
      var invalidMsg = "";
      let self = this;
      if (this.enrollOption.need_group && this.togetherInfo.dangqi) {
        this.user.groupName = this.togetherInfo.dangqi;
      }
      //user所有的key都必须有值
      console.log('this.user',this.user)
      for (var key in this.user) {
        if (key == "infos") {
          //检查user.infos里的每项内容
          console.log('this.user.infos',this.user.infos)
          console.log('this.enrollOption',this.enrollOption)
          for (var i in this.user.infos) {
            var info = this.user.infos[i];
            if (!info.v && info.require == true) {
              console.log("ggggg");
              isValid = false;
              invalidMsg = `报名人员的“${info.name}”未填写`;
              break;
            }
          }
          if (!isValid) {
            break;
          }
        } else {
          if (!this.user[key] && key != "isDefault" && key != "isChecked") {
            isValid = false;
            console.log(key);
            invalidMsg = `报名人员的“${self.fieldMap[key]}”未填写`;
            break;
          }

          if(key == 'idCode' && this.enrollOption.need_idCode){//判断身份证是否正确
              if(!!this.user[key] && this.user[key].length > 14){
                if(!isCardID(this.user[key])){
                  isValid = false;
                  invalidMsg = `报名人员的“身份证”号码填写错误`;
                  break
                }
              }
            }
          // if (this.enrollOption.need_assemble) {
          //   if (this.user.place == "选择集合地") {
          //     isValid = false;
          //     console.log(key);
          //     invalidMsg = `报名人员的“集合地”未填写`;
          //     break;
          //   }
          // }
        }
      }

      //错误提示
      if (!isValid) {
        this.$toast.fail(invalidMsg);
        return;
      }

      var user = objectAssign({}, this.user);
      this.showZanLoading$();
      if (this.userSelect >= 0) {
        if (user.isDefault) {
          user.isDefault = 1;
        } else {
          user.isDefault = 0;
        }
        console.log("user", user);
        this.changeUsersFlag = true
        if (!user.id) {
          //判断是否是数据库读取的联系人
          this.enrollUsers[this.userSelect] = this.user;
          this.enrollUsersCopy[this.userSelect] = this.user;
          this.enrollUsers[this.userSelect].isChecked = true;
          this.enrollUsersCopy[this.userSelect].isChecked = true;
          this.hideZanLoading$();
          //  this
          // this.$dialog.alert({ message: '修改成功' });
          
          weui.alert("修改成功", { isAndroid: false });
          this.userSelect = -1;
          this.closeAddPersonModal();
          this.user = {};
          let smallnum = 0;
          let bignum = 0;
          console.log("监听人数");
          // console.log(this.enrollUsers)
          for (let i = 0; i < this.enrollUsers.length; i++) {
            if (
              this.enrollUsers[i].adult == 2 &&
              this.enrollUsers[i].isChecked
            ) {
              smallnum++;
              this.smallPerson.num = smallnum;
            } else {
              this.smallPerson.num = smallnum;
            }
            if (
              this.enrollUsers[i].adult == 1 &&
              this.enrollUsers[i].isChecked
            ) {
              bignum++;
              this.bigPerson.num = bignum;
            } else {
              this.bigPerson.num = bignum;
            }
          }
          this.changeUsersFlag = false
          return;
        }
        actService
          .editEnrollUser({
            id: user.id,
            userId: pub.userInfo.userId,
            nickName: user.name,
            sex: user.sex,
            mobile: user.phone,
            identifyId: user.idCode,
            adult: user.adult,
            isDefault: user.isDefault,
            infos: JSON.stringify(user.infos)
          })
          .then(
            result => {
              // this.enrollUsers[this.userSelect] = this.user;
              // this.enrollUsersCopy[this.userSelect] = this.user;
              this.$set(this.enrollUsers,this.userSelect,this.user);
              this.$set(this.enrollUsersCopy,this.userSelect,this.user);
              //  this.enrollUsers[this.userSelect].isChecked = true
              this.hideZanLoading$();
              //  this
              // this.$dialog.alert({ message: '修改成功' });
              weui.alert("修改成功", { isAndroid: false });
              this.userSelect = -1;
              if (this.userEditType == 1) {
                this.addPersonFlag = false;
                this.calculateOrder()
                this.isShowUserEdit = false;
              } else {
                this.isShowUserEdit = false;
              }

              this.user = {};
              let smallnum = 0;
              let bignum = 0;
              // console.log("监听人数");
              // console.log(this.enrollUsers)
              for (let i = 0; i < this.enrollUsers.length; i++) {
                if (
                  this.enrollUsers[i].adult == 2 &&
                  this.enrollUsers[i].isChecked
                ) {
                  smallnum++;
                  this.smallPerson.num = smallnum;
                } else {
                  this.smallPerson.num = smallnum;
                }
                if (
                  this.enrollUsers[i].adult == 1 &&
                  this.enrollUsers[i].isChecked
                ) {
                  bignum++;
                  this.bigPerson.num = bignum;
                } else {
                  this.bigPerson.num = bignum;
                }
              }
            },
            error => {
              this.hideZanLoading$();
              weui.alert(error.msg, { isAndroid: false });
              // this.$dialog.alert({ message: error.msg });
            }
          );
      } else {
        if (user.isDefault) {
          user.isDefault = 1;
        } else {
          user.isDefault = 0;
        }
        actService
          .addEnrollUser({
            userId: pub.userInfo.userId,
            nickName: user.name,
            sex: user.sex,
            isDefault: user.isDefault,
            mobile: user.phone,
            identifyId: user.idCode,
            adult: user.adult,
            infos: JSON.stringify(user.infos)
          })
          .then(
            result => {
              // console.log(result);
              this.hideZanLoading$();
              if (result.code == 0) {
                user.id = result.ret;
                // user.isChecked = true
                if (user.isDefault) {
                  this.enrollUsers.unshift(user);
                  this.enrollUsersCopy.unshift(user);
                } else {
                  this.enrollUsers.push(user);
                  this.enrollUsersCopy.push(user);
                }

                // this.isShowUserEdit = false;
                // this.addPersonFlag = false
                this.isShowUserEdit = false;
              }
            },
            error => {
              this.hideZanLoading$();
              weui.alert(error.msg, { isAndroid: false });
              // this.$dialog.alert({ message: error.msg });
            }
          );
      }
    },
    removeEnrollUser(index) {
      //删除第 index 个用户
      this.enrollUsers.splice(index, 1);
    },
    /**
     * 提交报名
     */
    submitEnroll() {
      let self = this;
      let prepayOrderInfo = {};
      //先合法性检查
      var isValid = true;
      var invalidMsg = "";
      // console.log(this.actInfo.subType)
      if (this.actInfo.subType == 2 || this.actInfo.subType == 4) {
        // if (!this.actJoinInfo.selectDate) {
        //   isValid = false;
        //   invalidMsg = "请选择出发日期";
        // }
        // if(!this.calendarList[this.calendarSelect].day){
        //   isValid = false;
        //   invalidMsg = "请选择出发日期";
        // }
        if (this.calendarSelect == -1) {
          isValid = false;
          invalidMsg = "请选择出发日期";
        } else {
          //周期活动，选择的日期必须在允许的礼拜内
          if (this.actInfo.subTag < 127) {
            // var dayOfWeek = new Date(this.actJoinInfo.selectDate).getDay(); //0周日 6周六
            var dayOfWeek = new Date(
              this.calendarList[this.calendarSelect].day
            ).getDay(); //0周日 6周六
            var allowDayOfWeek = [];

            var _t = "每周";
            var week = ["一", "二", "三", "四", "五", "六", "日"];
            week.forEach(function(value, index) {
              if (self.actInfo.subTags[index]) {
                _t += value;

                allowDayOfWeek.push(index + 1);
              }
            });
            _t += "出发，请选择允许的日期";

            if (
              allowDayOfWeek
                .join("")
                .replace("7", "0")
                .indexOf(dayOfWeek) == -1
            ) {
              isValid = false;
              invalidMsg = _t;
            }
          }
        }
      }
      // if (this.tpl_enrollUser.place == '选择集合地') {
      //   this.$dialog.alert({ message: "选择集合地" });
      //   return;
      // }

      if (this.enrollOption.need_group && this.togetherInfo.dangqi) {
        for (let i = 0; i < this.enrollUsers.length; i++) {
          if (this.togetherInfo.dangqi) {
            this.enrollUsers[i].groupName = this.togetherInfo.dangqi;
          }
        }
      }

      var selectedEnrollers = [];
      if (!this.enrollUsers || this.enrollUsers.length == 0) {
        weui.alert("请添加报名人员", { isAndroid: false });
        // this.$dialog.alert({ message: "请添加报名人员" });
        return;
      } else {
        for (var i = 0; i < this.enrollUsers.length; i++) {
          var member = this.enrollUsers[i];
          if (this.packagePayArray.length > 0 && member.packagePayNo > 0) {
            var packageInfos = JSON.parse(this.actInfo.packagePay);
            member.packagePayInfo = packageInfos[member.packagePayNo - 1];
          }
          if (member.isChecked) {
            selectedEnrollers.push(member);
          }
        }
      }
      if (selectedEnrollers.length <= 0) {
        weui.alert("请选择报名人员", { isAndroid: false });
        // this.$dialog.alert({ message: "请选择报名人员" });
        return;
      }

      if (isValid) {
        console.log("selectedEnrollers", selectedEnrollers);
        selectedEnrollers.forEach((user, index) => {
          if (!isValid) return;
          //user所有的key都必须有值
          // console.log('user',user)
          for (var key in user) {
            if (key == "infos") {
              //检查user.infos里的每项内容
              for (var i in user.infos) {
                var info = user.infos[i];
                if (!info.v && info.require == true) {
                  isValid = false;
                  invalidMsg = `${user.name}的“${info.name}”未填写`;
                  break;
                }
              }
              if (!isValid) {
                break;
              }
            } else {
              if (!user[key] && key != "isDefault" && key != "isChecked") {
                isValid = false;
                invalidMsg = `${user.name}的“${self.fieldMap[key]}”未填写`;
                break;
              }
              if (this.enrollOption.need_assemble) {
                if (user.place == "选择集合地") {
                  isValid = false;
                  console.log(key);
                  invalidMsg = `${user.name}的“集合地信息”未填写`;
                  break;
                }
              }
            }
          }
        });
      }

      //错误提示
      if (!isValid) {
        weui.alert(invalidMsg, { isAndroid: false });
        // this.$dialog.alert({ message: invalidMsg });
        return;
      }

      //准备提交到服务后台的数据
      // console.log(selectedEnrollers)
      // return
      var _enrollUsers = JSON.stringify(selectedEnrollers);
      //处理一下infos
      var obj_enrollUsers = JSON.parse(_enrollUsers);
      obj_enrollUsers.forEach(function(obj) {
        if (obj.infos) {
          obj.infos.forEach(function(info) {
            delete info.ph;
          });
        }
      });
      _enrollUsers = JSON.stringify(obj_enrollUsers);
      // console.log('obj',obj_enrollUsers)
      // return false
      var source = 2;
      if (this.isInApp && this.versionCode >= 70) {
        source = 1;
      }
      //再提交创建订单
      // return
      console.log("_enrollUsers", _enrollUsers);
      this.showZanLoading$();
      actService
        .joinActivityFromWx({
          activityId: this.activityId,
          iid: this.iid,
          agent: pub.userInfo.userId,
          remark: this.actJoinInfo.remark ? this.actJoinInfo.remark : "",
          period:
            this.calendarSelect >= 0
              ? new Date(this.calendarList[this.calendarSelect].day).getTime()
              : 0,
          infos: _enrollUsers,
          num: this.enrollNumber,
          source: source
        })
        .then(
          result => {
            this.hideZanLoading$();
            if (result.code > 0) return;
            let joinIds = result.strRet;
            // return
            if (this.actInfo.payType === 1 || this.actInfo.payType === 4) {
              let that = this;
              weui.confirm("活动报名成功", {
              title: "提示",
              buttons: [
                {
                  label: "确定",
                  type: "primary",
                  onClick: () => {
                    that.gotoActDetail();
                  }
                }
              ],
              isAndroid: false
            });
              // weui.alert("活动报名成功", { isAndroid: false }, () => {
              //   that.gotoActDetail();
              // });
              // this.$dialog
              //   .alert({
              //     message: "活动报名成功"
              //   })
              //   .then(() => {
              //     that.gotoActDetail();
              //   });
            } else {
              this.createOrder(joinIds)
              // console.log(joinIds);
              // this.gotoActPrepay(joinIds);
            }
          },
          error => {
            self.hideZanLoading$();
            if (error.code == 100) {
              let that = this;
              weui.alert(
                "系统检查到您的手机号为会员账号，可绑定手机号激活会员身份，即刻享受会员特权",
                { isAndroid: false },
                () => {
                  this.bindMobileShow = true;
                }
              );
              // this.$dialog
              //   .alert({
              //     message: "系统检查到您的手机号为会员账号，可绑定手机号激活会员身份，即刻享受会员特权"
              //   })
              //   .then(() => {
              //     this.bindMobileShow = true
              //   });
            } else {
              weui.alert(error.msg, { isAndroid: false });
              // self.$dialog.alert({ message: error.msg });
            }
          }
        );
    },
    /**
     * 修改vux和select组件高度
     */
    initStyle() {
      var elements = window.document.getElementsByClassName("weui-select");
      for (var i = 0; i < elements.length; i++) {
        var ele = elements[i];
        ele.style.height = "30px";
      }
    }
  },
  watch: {
    isUseConin(val) {//监听积分是否使用
      this.parseExtraInfo();
    },
    discountCodePrice(val){
      this.parseExtraInfo();
    },
    isShowUserEdit: {
      handler(newName, oldName) {
        let dom = document.getElementById("main");
        if (this.isShowUserEdit) {
          console.log("dom", dom);
          dom.style.height = "100vh";
        } else {
          dom.style.height = "100%";
        }
      }
    },
    addPersonFlag: {
      handler(newName, oldName) {
        let dom = document.getElementById("main");
        if (this.addPersonFlag) {
          console.log("dom", dom);
          dom.style.height = "100vh";
        } else {
          dom.style.height = "100%";
        }
      }
    },
    enrollUsers: {
      //计算儿童成人数量
      handler(newName, oldName) {
        let smallnum = 0;
        let bignum = 0;
        console.log("监听人数");
        console.log(this.enrollUsers);
        for (let i = 0; i < this.enrollUsers.length; i++) {
          if (this.enrollUsers[i].adult == 2 && this.enrollUsers[i].isChecked) {
            smallnum++;
            this.smallPerson.num = smallnum;
          } else {
            this.smallPerson.num = smallnum;
          }
          if (this.enrollUsers[i].adult == 1 && this.enrollUsers[i].isChecked) {
            bignum++;
            this.bigPerson.num = bignum;
          } else {
            this.bigPerson.num = bignum;
          }
        }
        if(!!pub){
          
          // if(this.needCalculate){return}
          clearTimeout(this.timeOut)
          console.log('重新计算价格')
          this.timeOut = setTimeout(()=>{
            // this.calculateOrder()
          },300)
          
        }

      },
      immediate: true,
      deep: true
    },
    togetherInfo: {
      //监听集合地和活动档期
      handler(newName, oldName) {
        console.log("监听集合");
        console.log(this.enrollUsers);
        for (let i = 0; i < this.enrollUsers.length; i++) {
          if (this.togetherInfo.place) {
            // this.enrollUsers[i].place = this.togetherInfo.place
            // this.tpl_enrollUser.place = this.togetherInfo.place
          }
          if (this.togetherInfo.dangqi) {
            this.enrollUsers[i].groupName = this.togetherInfo.dangqi;
            this.tpl_enrollUser.groupName = this.togetherInfo.dangqi;
          }
        }
      },
      immediate: true,
      deep: true
    }
    // 'user.addtionPayInfo':{
    //   handler(newName, oldName){
    //     console.log('改了了单房差',this.user)
    //     if(!!this.user.addtionPayInfo && this.user.addtionPayInfo.length){
    //       let flag = this.user.addtionPayInfo.some((item,index,arr)=>{
    //         return item.isSelected == false
    //       })
    //       console.log(flag)
    //       if(flag){
    //         this.isShowTip = true
    //       }else{
    //         this.isShowTip = false

    //       }
    //     }else{
    //         // this.isShowTip = true

    //     }

    //   },
    //   immediate: true,
    //   deep: true
    // }
  },
  filters: {
    getWeek: function(value) {
      //日期过滤
      switch (value) {
        case 0:
          return "周日";
          break;
        case 1:
          return "周一";
          break;
        case 2:
          return "周二";
          break;
        case 3:
          return "周三";
          break;
        case 4:
          return "周四";
          break;
        case 5:
          return "周五";
          break;
        case 6:
          return "周六";
          break;
        default:
          break;
      }
    },
    getDay: function(value) {
      if (value) {
        value = value.slice(5);
        return value;
      }
    },
    integrity1: function(value) {
      if (value) {
        if (value.addtionPayInfo && value.addtionPayInfo.length) {
          let flag = value.addtionPayInfo.some((item, index, arr) => {
            return item.isSelected == false;
          });
          // console.log(flag)
          if (flag) {
            return "点击可以选择/修改附加服务";
          } else {
            return "";
          }
        }
      }
    },
    integrity: function(value) {
      if (value) {
        //  console.log('value',value)
        let values = Object.values(value);
        //  console.log('values',values)
        let flag = false;
        values.forEach((item, index) => {
          //  console.log(item.__proto__.constructor==Array)
          // console.log(item)
          if (
            typeof item != "undefined" &&
            item.__proto__.constructor == Array
          ) {
            // console.log("item", item);
            item.forEach((el, i) => {
              // console.log("el", el);
              for (var key in el) {
                if (
                  el[key] == "" &&
                  !el[key] &&
                  key == "v" &&
                  el.require == true
                ) {
                  // console.log('kong')
                  flag = true;
                  // return 1; // 终止程序
                }
              }
            });
          } else if (item === "" || item === "选择集合地") {
            // console.log("必填的item", item);
            flag = true;
          }
          //  console.log(flag)
        });
        if (flag) {
          return `${value.name}有必须填写的信息未填写，点击填写`;
        }
        // let flag = values.some(function(item,index,arr){
        //   console.log(item)
        //   if(typeof(item) != "undefined" &&  item.isArray){
        //     console.log(4)
        //     let flag = ''
        //     item.forEach((el,index)=>{
        //       console.log(el)
        //       if(el.v == ''){
        //         flag =  1
        //       }
        //     })
        //     console.log(flag)
        //     return flag
        //   }
        //   return item == ''
        // })
        // console.log(flag)
        // if(flag){
        //   return `${value.name}有未填写的信息`
        // }
      }
    },
    integrityedit: function(value) {
      if (value) {
        //  console.log('value',value)
        let values = Object.values(value);
        //  console.log('values',values)
        let flag = false;
        values.forEach((item, index) => {
          //  console.log(item.__proto__.constructor==Array)
          // console.log(item)
          if (
            typeof item != "undefined" &&
            item.__proto__.constructor == Array
          ) {
            // console.log("item", item);
            item.forEach((el, i) => {
              // console.log("el", el);
              for (var key in el) {
                if (
                  el[key] == "" &&
                  !el[key] &&
                  key == "v" &&
                  el.require == true
                ) {
                  // console.log('kong')
                  flag = true;
                  // return 1; // 终止程序
                }
              }
            });
          } else if (item === "" || item === "选择集合地") {
            // console.log("必填的item", item);
            flag = true;
          }
          //  console.log(flag)
        });
        if (flag) {
          return `有必填信息未填写,点击填写`;
        }
      }
    }
  }
};
</script>

<style lang="less" scoped>
.title() {
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #333;
  font-size: 14px;
  // font-weight: bold;
  line-height: 40px;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
  // border-bottom: 1px solid #f1f1f1;
  // margin-bottom: 1px;
}
.buy-left() {
  width: 35%;
}
.buy-right() {
  width: 65%;
}
.main {
  width: 100%;
  height: 100%;
  background: rgba(243, 243, 243, 1);
  overflow: hidden;
  box-sizing: border-box;
  padding: 10px;
  padding-bottom: 70px;
  font-family: PingFangSC-Regular, PingFang SC;
  // 活动信息
  .act-info {
    width: 100%;
    padding: 15px;
    background: #fff;
    box-sizing: border-box;
    border-radius: 10px;
    padding-top: 0;
    .act-title {
      .title;
      // height: 30px;
    }
    .act-content {
      display: flex;
      padding-top: 10px;
      .image {
        height: 60px;
        width: 60px;
        width: 55px;
        height: 55px;
        background: rgba(216, 216, 216, 1);
        border-radius: 6px;
        img {
          width: 100%;
          height: 100%;
          // height: calc((100vw - 70px) * 0.667);
          // clip-path: inset(0px 0px 30px 40px)
        }
      }
      .detail {
        width: 71%;
        height: 60px;
        padding: 5px 0 5px 5px;
        box-sizing: border-box;
        .small-title {
          // width: 245px;
          max-height: 38px;
          font-size: 14px;
          font-family: PingFangSC-Medium, PingFang SC;
          font-weight: 500;
          color: rgba(51, 51, 51, 1);
          line-height: 19px;
          text-overflow: -o-ellipsis-lastline;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 2;
          line-clamp: 2;
          -webkit-box-orient: vertical;
        }
        .desc {
          font-size: 12px;
          line-height: 15px;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 2;
          overflow: hidden;
          color: #666;
        }
      }
    }
  }
  //日期选择
  .calendar-select {
    margin-top: 6px;
    width: 100%;
    padding: 15px;
    background: #fff;
    box-sizing: border-box;
    border-radius: 10px;
    padding-top: 0;
    .calendar-title {
      .title;
    }
    .calendar-box {
      width: 100%;
      box-sizing: border-box;
      display: flex;
      // height: 30px;
      .calendar-list {
        box-sizing: border-box;
        width: 85%;
        display: flex;
        .calendar-item {
          width: 25%;
          display: flex;
          box-sizing: border-box;
          flex-direction: column;
          align-items: center;
          justify-content: center;
          height: 48px;
          border-radius: 5px;
          position: relative;
          overflow: hidden;
          margin-right: 2px;
          border: 1px solid #f5f5f5;
          // box-shadow: 2px 2px 5px #eaeaea;
          &.disable {
            background: #ccc !important;
            color: #ccc;
            cursor: not-allowed;
            opacity: 0.5;
          }
          img {
            position: absolute;
            right: 0;
            bottom: 0;
            width: 20px;
            height: 20px;
          }
          .day {
            font-size: 12px;
            color: #333;
          }
          .price {
            color: #ff2525;
            font-size: 13px;
          }
          &.active {
            border: 1px solid #02bad3;
            // box-shadow: 1px 1px 3px #02bad3;
          }
        }
      }
      .calendar-more {
        width: 15%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        box-shadow: -2px 0 2px #f7f7f7;
        img {
          width: 15px;
          height: 15px;
        }
        span {
          font-size: 12px;
        }
      }
    }
  }
  //套餐类型
  .package-type {
    margin-top: 6px;
    width: 100%;
    padding: 15px;
    background: #fff;
    box-sizing: border-box;
    padding-top: 0;
    border-radius: 10px;
    overflow: hidden;
    .package-title {
      .title;
    }
    .package-list {
      // width: 100%;
      display: flex;
      width: max-content;
      // flex-wrap: wrap;
      .package-item {
        background: #f5f5f5;
        margin-right: 10px;
        display: inline-block;
        text-align: center;
        width: 140px;
        height: 51px;
        padding: 10px 7px 7px;
        vertical-align: top;
        position: relative;
        -webkit-border-radius: 5px;
        border-radius: 5px;
        box-sizing: border-box;
        .tag {
          position: absolute;
          z-index: 99;
          top: -8px;
          left: 50%;
          -webkit-transform: translate3d(-50%, 0, 0);
          transform: translate3d(-50%, 0, 0);
          padding: 1px 3px 1px 4px;
          height: 16px;
          -webkit-border-radius: 5px;
          border-radius: 5px;
          -webkit-border-top-right-radius: 0;
          border-top-right-radius: 0;
          -webkit-border-bottom-left-radius: 0;
          border-bottom-left-radius: 0;
          line-height: 14px;
          font-size: 10px;
          font-weight: 500;
          background-color: #fff;
          color: #666;
        }
        .tit {
          font-size: 13px;
          line-height: 18px;
          height: 18px;
          font-weight: 400;
          overflow: hidden;
          white-space: nowrap;
          -o-text-overflow: ellipsis;
          text-overflow: ellipsis;
          color: #666;
        }
        img {
          position: absolute;
          right: 0;
          bottom: 0;
          width: 25px;
          height: 25px;
        }
        &.active {
          background: #ff9800;
          // box-shadow: 2px 2px 5px #02bad3;
          color: #fff;
          .tit {
            color: #fff;
          }
          .sanjiao {
            position: absolute;
            font-size: 0;
            line-height: 0;
            bottom: -6px;
            left: 50%;
            margin-left: -7px;
            z-index: 99;
            border-left: 7px solid transparent;
            border-right: 7px solid transparent;
            border-top: 7px solid #ff9800;
          }
          // &:before{
          //   content: '';
          //   position: absolute;
          //   font-size: 0;
          //   line-height: 0;
          //   bottom: -6px;
          //   left: 50%;
          //   margin-left: -7px;
          //   z-index: 1000;
          //   border-left: 7px solid transparent;
          //   border-right: 7px solid transparent;
          //   border-top: 7px solid #ff9800;
          // }
        }
        .small-title {
          color: #999;
          font-size: 14px;
          text-align: center;
          font-weight: bold;
        }
        .small-desc {
          font-size: 12px;
          color: #666;
          text-align: center;
        }
      }
    }
  }
  //购买数量
  .buy-number {
    margin-top: 6px;
    width: 100%;
    padding: 15px;
    background: #fff;
    box-sizing: border-box;
    border-radius: 10px;
    padding-top: 0;
    .buy-title {
      .title;
    }
    .buy-box {
      width: 100%;
      padding-top: 10px;
      .buy-bigpeople {
        display: flex;
        .buy-left {
          .buy-left;
          span {
            color: #333;
            font-size: 13px;
            margin-right: 15px;
          }
        }
        .buy-right {
          .buy-right;
          span {
            color: #333;
            // margin-left: 5px;
            // margin-right: 5px;
            font-size: 14px;
          }
          button {
            width: 20px;
            height: 20px;
            border: 0;
            border-radius: 5px;
          }
        }
      }
      .buy-smallpeople {
        display: flex;
        .buy-left {
          .buy-left;
          span {
            color: #333;
            font-size: 13px;
            margin-right: 15px;
          }
        }
        .buy-right {
          .buy-right;
          span {
            color: #333;
            // margin-left: 5px;
            // margin-right: 5px;
            font-size: 14px;
          }
          button {
            width: 20px;
            height: 20px;
            border: 0;
            border-radius: 5px;
          }
        }
      }
      .buy-count{
        text-align: right;
        span{
          font-size: 13px!important;
          color: rgb(252, 94, 94)!important;
        }
      }
      .item /deep/ {
        .van-cell {
          padding: 0 !important;
          height: 30px;
          line-height: 30px;
          .van-cell__title {
            font-size: 14px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #666666;
          }
          .van-cell__value {
            font-size: 13px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: rgba(208, 208, 208, 1);
            color: rgb(252, 94, 94);
            &.usediscount{
              color: rgb(252, 94, 94);
            }
          }
          
        }
      }
    }
  }
  //游客信息
  .tourist-info {
    margin-top: 6px;
    width: 100%;
    padding: 15px;
    background: #fff;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 10px;
    padding-top: 0;
    .tourist-title {
      .title;
      display: flex;
      .dis-tip{
        margin-left: auto;
      }
      i {
        float: right;
        color: #666;
      }
    }
    .question-box {
      position: fixed;
      width: 100px;
      height: 100px;
      z-index: 600;
      left: 0%;
      right: 0%;
      top: 0%;
      bottom: 0%;
      background: #fff;
      margin: auto;
    }
    // .tourist-list {
    //   width: 100%;
    //   display: flex;
    //   line-height: 32px;
    //   flex-wrap: wrap;
    //   padding-top: 10px;
    //   .tour-item {
    //     width: 20%;
    //     border: 1px solid #02bad3;
    //     color: #02bad3;
    //     font-size: 13px;
    //     text-align: center;
    //     line-height: 32px;
    //     border-radius: 5px;
    //     position: relative;
    //     // overflow: hidden;
    //     margin-right: 2%;
    //     margin-bottom: 4px;
    //     &.active{
    //       box-shadow: 0px 0px 3px #02bad3;
    //     }
    //     img {
    //       position: absolute;
    //       right: 0;
    //       bottom: 0;
    //       width: 20px;
    //       height: 20px;
    //       &.del{
    //         top: -10px;
    //         right: -10px
    //       }
    //     }
    //   }
    //   .add-change {
    //     width: 20%;
    //     border: 1px dashed #d3d3d3;
    //     color: #02bad3;
    //     font-size: 13px;
    //     text-align: center;
    //     line-height: 32px;
    //     border-radius: 5px;
    //     position: relative;
    //     overflow: hidden;
    //     margin-bottom: 4px;
    //   }
    // }
    .tourist-list {
      padding-top: 5px;
      .item {
        display: flex;
        align-items: center;
        height: 40px;
        .left {
          font-size: 14px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: rgba(102, 102, 102, 1);
          width: 60px;
          flex-shrink: 0;
        }
        .mid {
          font-size: 13px;
          font-family: PingFangSC-Medium, PingFang SC;
          font-weight: 400;
          color: rgba(51, 51, 51, 1);
          margin-left: 5px;
          
          flex: 1;
          // display: flex;
          position: relative;
          height: 100%;
          height: 40px;
          line-height: 35px;
          .tip{
            position: absolute;
            right: 0;
            bottom: 0;
            font-size: 12px;
            -webkit-transform: scale(0.5);
            transform: scale(0.5);
            -webkit-transform-origin: 100% 100%;
            transform-origin: 0% 100%;
            left: 0;
            color: #fe0034;
          }
          .name {
            margin-right: 20px;
            font-size: 13px;
          }
          .phone {
            font-size: 13px;
          }
        }
        .btn {
          width: 50px;
          margin-left: auto;
          display: flex;
          justify-content: flex-end;
          // svg {
          //   color: rgba(209, 209, 209, 1);
          //   width: 14px;
          //   height: 14px;
          // }
        }
      }
      &.tourist-list-new{
        .item1{
          height: max-content;
          align-items: flex-start;
          .left{
            padding-top: 8px;
          }
          .mid{
            height: max-content;
            position: relative;
            padding-bottom: 12px;
            .edit{
              position: absolute;
              right: -0px;
              top: 0;
            }
            .name{
              height: 30px;
            }
            .phone{
              height: 30px;
            }
          }
        }
        .item1 /deep/ {
          .weui-cells:before {
            height: 0;
            border: 0;
          }
          .weui-select {
            height: 35px!important;
            line-height: 42px!important;
          }
          .weui-cells:after {
            height: 0;
            border: 0;
          }
          .weui-cell:before {
            height: 0;
            border: 0;
          }
          .vux-no-group-title {
            margin-top: 0 !important;
          }
          .weui-cells {
            margin-top: 0 !important;
          }
          .weui-cell {
            padding: 0 !important;
            height: 35px;
            display: flex;
            align-items: center;
            font-size: 13px!important;
            .weui-label {
              font-size: 13px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: rgba(102, 102, 102, 1) !important;
              width: 105px !important;
            }
            .weui-cell__ft {
              .weui-switch {
                height: 20px;
                border-radius: 10px;
              }
              .weui-switch:before {
                height: 18px;
                border-radius: 10px;
                // top: -1px;
                box-shadow: 0;
              }
              .weui-switch:after {
                height: 20px;
                border-radius: 10px;
                box-shadow: 0;
                top: -1px;
              }
            }
            .weui-cell__hd {
              font-size: 13px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: rgba(102, 102, 102, 1);
              width: 105px !important;
              .weui-label {
                font-size: 13px!important;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: rgba(102, 102, 102, 1) !important;
                width: 105px !important;
              }
            }
            .weui-cell_switch {
              .weui-cell__bd {
                font-size: 13px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #666 !important;
                width: 105px !important;
              }
            }
            .weui-cell__bd {
              input {
                font-size: 13px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #333;
              }
              .weui-select {
                height: 35px!important;
                line-height: 42px!important;
              }
              select {
                font-size: 13px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #333;
              }
              input::-webkit-input-placeholder {
                /* WebKit browsers */
                font-size: 13px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: rgba(208, 208, 208, 1);
              }
              input:-moz-placeholder {
                /* Mozilla Firefox 4 to 18 */
                font-size: 13px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: rgba(208, 208, 208, 1);
              }
              input::-moz-placeholder {
                /* Mozilla Firefox 19+ */
                font-size: 13px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: rgba(208, 208, 208, 1);
              }
              input:-ms-input-placeholder {
                /* Internet Explorer 10+ */
                font-size: 13px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: rgba(208, 208, 208, 1);
              }
            }
          }
        }
      }
    }
    .discount-list{
      & /deep/{
        .van-cell__right-icon{
              color: #d1d1d1;
        }
      }
    }
    .info-inp {
      margin-top: 5px;

      .info-item {
        // display: flex;
        .info-item-left {
          width: 15%;
          display: flex;
          align-items: center;
          justify-content: center;
        }
        .info-item-right {
          width: 100%;
          font-size: 13px;
          display: flex;
          color: #333;
          .right-left {
            width: 90%;
            display: flex;
            .jian {
              flex: 1;
              display: flex;
              align-items: center;
              justify-content: flex-end;
              padding-right: 15px;
              box-sizing: border-box;
            }
          }
          .right-right {
            img {
              width: 70%;
            }
            width: 10%;
            // flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            // justify-content: flex-end;
          }
        }
        .tip {
          color: #ff2525;
          font-size: 12px;
        }
      }

      .name,
      .phone,
      .id-card {
        display: flex;
        height: 30px;
        line-height: 30px;
      }
      .left {
        // width: 30%;
        width: 7em;
        font-size: 14px;
        color: #333;
      }
      .right {
        width: 70%;
        font-size: 14px;
        color: #333;
        input {
          border: 0;
          height: 30px;
        }
        // input:focus{
        //   border: 1px solid #02bad3;
        // }
        input::-webkit-input-placeholder {
          color: #999;
          font-size: 14px;
        }
      }
    }
  }
  .check-Layout {
    display: flex;
    height: 40px;
    width: 100%;
  }
  // .switch-layout {
  //   margin-left: calc(~"100% - 80px");
  // }
  .check-title-layout {
    float: left;
    height: 40px;
    // width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: absolute;
    line-height: 40px;
    font-size: 14px;
  }
  //联系人信息
  .contact-info {
    margin-top: 6px;
    width: 100%;
    padding: 15px;
    background: #fff;
    box-sizing: border-box;
    .contact-title {
      .title;
    }
    .contact-box {
      width: 100%;
      .name,
      .phone,
      .weixin {
        display: flex;
        .left {
          font-size: 14px;
          color: #333;
          width: 30%;
          line-height: 30px;
        }
      }
      input {
        border: 0;
        height: 30px;
      }
      input::-webkit-input-placeholder {
        color: #999;
        font-size: 14px;
      }
      .name {
        .inp {
          display: flex;
          justify-content: space-between;
          width: 70%;
          line-height: 30px;
          .tou {
            display: flex;
            justify-content: center;
            align-items: center;
          }
          img {
            width: 20px;
            height: 20px;
          }
        }
      }
      .phone {
        .left {
          display: flex;
          justify-content: space-between;
          .phone-select {
            width: 30px;

            // border: 1px solid #02bad3;
          }
        }
      }
    }
  }
  //集合信息
  .together-info {
    margin-top: 6px;
    width: 100%;
    padding: 15px;
    background: #fff;
    box-sizing: border-box;
    border-radius: 10px;
    .together-title {
      .title;
    }
    .together-box {
      width: 100%;
    }
  }
  //买家留言
  .buyer-message {
    margin-top: 6px;
    width: 100%;
    // padding: 15px;
    background: #fff;
    box-sizing: border-box;
    border-radius: 10px;
    .buyer-box {
      display: flex;
      height: 30px;
      line-height: 30px;
      .left {
        width: 30%;
        font-size: 14px;
        color: #333;
        font-size: 14px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #666666;
      }
      .right {
        width: 70%;
        input {
          border: 0;
          height: 30px;
        }
        input::-webkit-input-placeholder {
          color: #999;
          font-size: 14px;
        }
      }
    }
  }
  //报名须知
  .signup-tips {
    margin-top: 6px;
    width: 100%;
    padding: 15px;
    background: #fff;
    box-sizing: border-box;
    // padding-bottom: 70px;
    border-radius: 10px;
    padding-top: 0;

    .signup-title {
      .title;
    }
    .signup-box {
      line-height: 25px;
      font-size: 12px;
      color: #333;
      padding-top: 10px;
    }
  }
  //提交报名
  .sub {
    margin-top: 6px;
    width: 100%;
    padding: 15px;
    // background: #fff;
    box-sizing: border-box;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding-bottom: 6px;
    padding-top: 6px;
    background: #fff;
    display: flex;
    box-shadow: 0px 0 10px rgba(0, 0, 0, 0.04);
    .left {
      width: 60%;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      font-size: 17px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: rgba(51, 51, 51, 1);
      padding-left: 20px;
      box-sizing: border-box;
      .value {
        color: #ff1414;
        .fu {
          font-size: 12px;
        }
      }
    }
    .btn {
      // width: 100%;
      flex: 1;
      height: 40px;
      background: #02bad3;
      text-align: center;
      color: #fff;
      line-height: 40px;
      border-radius: 40px;
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: rgba(255, 255, 255, 1);
    }
  }
  //需要弹出来的增加人员模态框
  .addPerson-modal {
    position: absolute;
    z-index: 800;
    // height: 100%;
    height: 100vh;
    overflow: hidden;
    width: 100%;
    left: 0;
    bottom: 0;
    top: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.3);
    .weui-cell__hd {
      width: 6em !important;
    }
    .weui-label {
      width: 6em !important;
    }
    .chosePerson-box {
      width: 80%;
      position: fixed;
      min-height: 90px;
      right: 0%;
      background: #fff;
      z-index: 999;
      margin: auto;
      padding: 10px;
      padding-top: 30px;
      padding-bottom: 20px;
      border-radius: 10px;
      position: absolute;
      top: 50%;
      left: 50%;
      box-sizing: boeder-box;
      transform: translate3d(-50%, -50%, 0);
      .noPerson {
        font-size: 13px;
        line-height: 90px;
        text-align: center;
        color: #999;
      }
      .close-modal {
        position: absolute;
        right: 0px;
        top: 0px;
        width: 30px;
        height: 30px;
        line-height: 30px;
        text-align: center;
        i {
          font-size: 20px;
        }
      }
      .check-line {
        display: flex;
        justify-content: space-between;
        align-items: center;
        .check-style {
          padding-top: 10px;
          padding-bottom: 10px;
          font-size: 14px;
          box-sizing: border-box;
        }
        .check-action-layout {
          // width:70%;
          line-height: 43px;
          display: flex;

          img {
            width: 20px;
            height: 20px;
          }
        }
      }
    }
    .addPerson-box {
      width: 80%;
      background: #fff;
      z-index: 999;
      margin: auto;
      padding: 10px;
      border-radius: 10px;
      position: absolute;
      top: 50%;
      left: 50%;
      box-sizing: border-box;
      -webkit-transform: translate3d(-50%, -50%, 0);
      transform: translate3d(-50%, -50%, 0);
      .weui-cell__hd {
        width: 6em !important;
      }
      .weui-label {
        width: 6em !important;
      }
      // .add-itme {
      //   display: flex;
      //   .itme-left {
      //     width: 20%;
      //     font-size: 14px;
      //     color: #333;
      //   }
      //   .item-right {
      //     width: 80%;
      //     input {
      //       border: 1px solid #ccc;
      //       width: 80%;
      //     }
      //   }
      // }
      .close-modal {
        position: absolute;
        right: 0px;
        top: 0px;
        width: 30px;
        height: 30px;
        line-height: 30px;
        text-align: center;
        i {
          font-size: 20px;
        }
      }
    }
  }
  //是否删除
  .maydel {
    position: fixed;
    z-index: 1000;
    height: 100%;
    width: 100%;
    left: 0;
    bottom: 0;
    top: 9;
    right: 0;
    background: rgba(0, 0, 0, 0.3);
    .del-box {
      width: 200px;
      position: fixed;
      min-height: 90px;
      right: 0%;
      background: #fff;
      z-index: 999;
      margin: auto;
      padding: 10px;
      top: 50%;
      left: 50%;
      transform: translate3d(-50%, -50%, 0);
      border-radius: 5px;
      box-sizing: border-box;
      .tops {
        height: 30px;
        line-height: 30px;
        text-align: center;
      }
      .sure {
        color: #666;
        font-size: 14px;
        text-align: center;
        height: 25px;
        line-height: 25px;
      }
      .btns {
        display: flex;
        .btn-left,
        .btn-riht {
          width: 50%;
          text-align: center;
          height: 40px;
          line-height: 40px;
          border-top: 1px solid #eeee;
        }
        .btn-left {
          color: #333;
          border-right: 1px solid #eeee;
        }
        .btn-riht {
          color: orange;
        }
      }
    }
  }
  .copy-text {
    .box {
      padding: 20px;
      box-sizing: border-box;
      textarea {
        width: 100%;
        border: 1px solid #f1f1f1;
      }
    }
  }
}
</style>
<style lang="less">
.hmember-type,
.hmember-sex {
  .weui-cells {
    padding: 0px !important;
    margin: 0px !important;
    border: 0 !important;
  }
  .weui-cell__hd {
    width: 7em !important;
  }
  .weui-cell {
    padding: 0px !important;
    margin: 0px !important;
    border: 0 !important;
  }
  .vux-selector.weui-cell_select-after {
    padding: 0px !important;
    margin: 0px !important;
    border: 0 !important;
  }
  .weui-label {
    color: #333;
    width: 7em !important;
  }
  .weui-cells:after {
    border: 0 !important;
    height: 0px !important;
    border-top: 0px !important;
  }
  .weui-cells:before {
    border: 0 !important;
    height: 0px !important;
    border-top: 0px !important;
  }
}
.edit_user{
  .weui-cell_select .weui-cell__bd:after{
    width: 9px;
    height: 16px;
  }
}
.tourist-list-new{
  .weui-label{
    width: 60px;
  }
  .weui-cell_select .weui-cell__bd:after{
    width: 9px;
    height: 16px;
  }
  .weui-select {
    height: 35px!important;
    line-height: 35px!important;
  }
  .check-Layout{
    height: 30px!important;
    position: relative;
    .check-title-layout{
      height: 30px!important;
      width: 60px;
      max-width: max-content;
      font-size: 13px!important;
      line-height: 30px;
      float: none!important;
      position: inherit;
      margin-right:10px;
    }
    .weui-cell__ft{
      display: flex;
      align-items: center;
    }
    .weui-switch, .weui-switch-cp__box {
        position: relative;
        width: 37px;
        height: 15px;
        border: 2px solid rgba(0,0,0,.1);
        border: 2px solid var(--weui-FG-3);
        outline: 0;
        border-radius: 16px;
        line-height: 30px;
        box-sizing: border-box;
        -webkit-transition: background-color .1s,border .1s;
        transition: background-color .1s,border .1s;
    }
    .weui-switch-cp__box:before, .weui-switch:before {
        content: " ";
        position: absolute;
        top: -2px;
        left: 0;
        bottom: 0;
        right: 0;
        height: 15px;
        width:37px;
        border-radius: 15px;
        background-color: #f7f7f7;
        background-color: var(--weui-BG-3);
        -webkit-transition: -webkit-transform .35s cubic-bezier(.45,1,.4,1);
        transition: -webkit-transform .35s cubic-bezier(.45,1,.4,1);
        transition: transform .35s cubic-bezier(.45,1,.4,1);
        transition: transform .35s cubic-bezier(.45,1,.4,1),-webkit-transform .35s cubic-bezier(.45,1,.4,1);
    }
    .weui-switch-cp__box:after, .weui-switch:after {
      content: " ";
      position: absolute;
      top: -2px;
      left: 0;
      width: 15px;
      height: 15px;
      border-radius: 15px;
      background-color: #fff;
      box-shadow: 0 1px 3px rgba(0,0,0,.4);
      -webkit-transition: -webkit-transform .35s cubic-bezier(.4,.4,.25,1.35);
      transition: -webkit-transform .35s cubic-bezier(.4,.4,.25,1.35);
      transition: transform .35s cubic-bezier(.4,.4,.25,1.35);
      transition: transform .35s cubic-bezier(.4,.4,.25,1.35),-webkit-transform .35s cubic-bezier(.4,.4,.25,1.35);
  }
  }
}
.group {
  border-image-width: 0;
  .weui-cells {
    margin-top: 0px !important;
  }
}
.jihe .vux-selector.weui-cell_select-after {
  padding: 0px !important;
  margin: 0px !important;
  border: 0 !important;
}
.group .weui-cell:before {
  border: 0 !important;
  height: 0px !important;
  border-top: 0px !important;
}
.group .weui-cells:before {
  border: 0 !important;
  height: 0px !important;
  border-top: 0px !important;
}
.group .weui-cells:after {
  border: 0 !important;
  height: 0px !important;
  border-top: 0px !important;
}
.check-Layout {
  .check-title-layout{
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #666666 !important;
    width: 105px !important;
  }
}
.jihe .weui-cells {
  padding: 0px !important;
  margin: 0px !important;
  border: 0 !important;
}

.jihe .weui-cell {
  padding: 0px !important;
  margin: 0px !important;
  border: 0 !important;
  border-image-width: 0;
}

.jihe .vux-no-group-title {
  margin-top: 0 !important;
  border-image-width: 0;
}
.huodongdangqi .vux-selector.weui-cell_select-after {
  padding: 0px !important;
  margin: 0px !important;
  border: 0 !important;
}
.huodongdangqi .vux-no-group-title {
  margin-top: 0 !important;
}
.huodongdangqi .weui-cells {
  padding: 0px !important;
  margin: 0px !important;
  border: 0 !important;
}
.huodongdangqi .weui-cell {
  padding: 0px !important;
  margin: 0px !important;
  border: 0 !important;
}
.huodongdangqi {
  .weui-label {
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #666666;
  }
}
.date-picker {
  width: 100%;
  height: 100%;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
  // display: none;
  .close_bg {
    position: absolute;
    width: 100%;
    height: 100%;
  }
  .picker {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
  }
  .week {
    text-align: center;
  }
  .calendar-title {
    padding: 0;
  }
  .wh_content_all {
    background-color: #fff !important;
  }
  .wh_content_item {
    color: #333 !important;
  }
  .wh_top_changge li {
    color: #333 !important;
  }
  .wh_jiantou1 {
    border-top: 2px solid #333 !important;
    border-left: 2px solid #333 !important;
  }
  .wh_jiantou2 {
    border-top: 2px solid #333 !important;
    border-right: 2px solid #333 !important;
  }
  .wh_content_item .wh_isToday {
    background: #fff !important;
    border-radius: 0 !important;
    color: green;
  }
  .wh_content_item .wh_chose_day {
    color: #fff;
  }
  // .calendar-year {
  //   .vux-prev-icon {
  //   }
  //   .calendar-header-right-arrow {
  //     .vux-next-icon {
  //     }
  //   }
  // }
}
.addPerson-modal {
  //人员增加盒子
  // .vux-selector.weui-cell_select-after {
  // }
  .weui-btn_mini {
    //保存按钮
    float: right;
  }
  .weui-cell:before {
    //上边框
    left: 0 !important;
    padding: 0;
  }
  .weui-cell {
    padding: 0 !important;
    height: 40px;
  }
  .weui-uploader__input-box {
    width: 80px;
    height: 80px;
  }
  .btn-layout {
    height: 30px;
    line-height: 30px;
    margin-top: 10px;
  }
  .weui-cell:before .vux-selector.weui-cell_select-after {
    padding: 0 15px;
    box-sizing: border-box;
  }
  .photo {
    height: 100px !important;
    padding: 5px 0;
    font-size: 0;
    box-sizing: border-box;
    span {
      font-size: 0;
    }
    .vue-upload {
      input {
        width: 100px;
        height: 100px;
      }
    }
  }
}
.addPerson-box {
  .weui-cell__hd {
    width: 6em !important;
  }
  .weui-cells:after {
    height: 0px !important;
    border-bottom: 0px !important;
    margin-top: 0 !important;
  }
  .weui-cells {
    margin-top: 0 !important;
    // background: none!important;
  }
  .weui-cell:before {
    height: 0 !important;
    border: 0 !important;
  }
  .weui-cells:before {
    height: 0 !important;
    border: 0 !important;
  }
  label {
    color: #646464 !important;
  }
  input {
    color: #646464 !important;
  }
  select {
    color: #646464 !important;
  }
  .check-title-layout {
    color: #646464 !important;
  }
}
.photoup {
  padding: 5px 0;
  box-sizing: border-box;
  font-size: 0;
  .weui-cell {
    padding: 0 !important;
    height: 40px;
  }
  .weui-cell:before {
    padding: 0px !important;
    left: 0px !important;
  }
  span {
    font-size: 0;
  }

  .photo {
    height: 100px !important;
    padding: 5px 0;
    box-sizing: border-box;
    font-size: 0;
    span {
      font-size: 0;
    }
  }
}
.addtion {
  .weui-cell:before {
    padding: 0px !important;
    margin: 0px !important;
    border: 0 !important;
    height: 0 !important;
    border-top: 0px !important;
  }
  .weui-cells:before {
    border: 0 !important;
    height: 0px !important;
    border-top: 0px !important;
  }
  .switch-layout {
    // margin-left: calc(100%-30px)!important;
    margin-left: auto !important;
    padding: 0 !important;
  }
}
.photou {
  .weui-cell__hd {
    width: 0 !important;
  }
}
.together-box {
  .weui-label {
    width: 7em;
  }
}
</style>